diff options
author | Mark Friedenbach <mark@friedenbach.org> | 2014-04-22 15:46:19 -0700 |
---|---|---|
committer | Mark Friedenbach <mark@blockstream.io> | 2014-09-26 15:42:04 -0700 |
commit | a372168e77a8a195613a02983f2589252698bf0f (patch) | |
tree | b300a5f7aa007645c6ba2bd708e7a962fab2894b /src/core.cpp | |
parent | 64cfaf891fe539b36f6be37dac6c28a712d70b96 (diff) |
Use a typedef for monetary values
Diffstat (limited to 'src/core.cpp')
-rw-r--r-- | src/core.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core.cpp b/src/core.cpp index e52327ba8e..1489d77bb3 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -43,7 +43,7 @@ std::string CTxIn::ToString() const return str; } -CTxOut::CTxOut(int64_t nValueIn, CScript scriptPubKeyIn) +CTxOut::CTxOut(const CAmount& nValueIn, CScript scriptPubKeyIn) { nValue = nValueIn; scriptPubKey = scriptPubKeyIn; @@ -59,7 +59,7 @@ std::string CTxOut::ToString() const return strprintf("CTxOut(nValue=%d.%08d, scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30)); } -CFeeRate::CFeeRate(int64_t nFeePaid, size_t nSize) +CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize) { if (nSize > 0) nSatoshisPerK = nFeePaid*1000/nSize; @@ -67,9 +67,9 @@ CFeeRate::CFeeRate(int64_t nFeePaid, size_t nSize) nSatoshisPerK = 0; } -int64_t CFeeRate::GetFee(size_t nSize) const +CAmount CFeeRate::GetFee(size_t nSize) const { - int64_t nFee = nSatoshisPerK*nSize / 1000; + CAmount nFee = nSatoshisPerK*nSize / 1000; if (nFee == 0 && nSatoshisPerK > 0) nFee = nSatoshisPerK; @@ -110,9 +110,9 @@ CTransaction& CTransaction::operator=(const CTransaction &tx) { return *this; } -int64_t CTransaction::GetValueOut() const +CAmount CTransaction::GetValueOut() const { - int64_t nValueOut = 0; + CAmount nValueOut = 0; BOOST_FOREACH(const CTxOut& txout, vout) { nValueOut += txout.nValue; |