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.
8 #include "tinyformat.h"
10 CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)
13 nSatoshisPerK = nFeePaid*1000/nSize;
18 CAmount CFeeRate::GetFee(size_t nSize) const
20 CAmount nFee = nSatoshisPerK*nSize / 1000;
22 if (nFee == 0 && nSatoshisPerK > 0)
28 std::string CFeeRate::ToString() const
30 return strprintf("%d.%08d BTC/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN);