]> Git Repo - VerusCoin.git/blob - src/amount.cpp
Auto merge of #1938 - ebfull:g2-subgroup-check, r=str4d
[VerusCoin.git] / src / amount.cpp
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6 #include "amount.h"
7
8 #include "tinyformat.h"
9
10 CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)
11 {
12     if (nSize > 0)
13         nSatoshisPerK = nFeePaid*1000/nSize;
14     else
15         nSatoshisPerK = 0;
16 }
17
18 CAmount CFeeRate::GetFee(size_t nSize) const
19 {
20     CAmount nFee = nSatoshisPerK*nSize / 1000;
21
22     if (nFee == 0 && nSatoshisPerK > 0)
23         nFee = nSatoshisPerK;
24
25     return nFee;
26 }
27
28 std::string CFeeRate::ToString() const
29 {
30     return strprintf("%d.%08d BTC/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN);
31 }
This page took 0.029875 seconds and 4 git commands to generate.