Add UpdatedBlockTip signal to CMainSignals and CValidationInterface
[bitcoinplatinum.git] / src / amount.cpp
blobb46918198448b1487e500a49dfceea3bec4b434e
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.
6 #include "amount.h"
8 #include "tinyformat.h"
10 const std::string CURRENCY_UNIT = "BTC";
12 CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)
14 if (nSize > 0)
15 nSatoshisPerK = nFeePaid*1000/nSize;
16 else
17 nSatoshisPerK = 0;
20 CAmount CFeeRate::GetFee(size_t nSize) const
22 CAmount nFee = nSatoshisPerK*nSize / 1000;
24 if (nFee == 0 && nSatoshisPerK > 0)
25 nFee = nSatoshisPerK;
27 return nFee;
30 std::string CFeeRate::ToString() const
32 return strprintf("%d.%08d %s/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT);