aboutsummaryrefslogtreecommitdiff
path: root/src/core.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2014-06-06 18:50:32 +0200
committerWladimir J. van der Laan <[email protected]>2014-06-06 18:51:00 +0200
commit95d68c48d7ae45cb2a7303152816e9391cfbd0c9 (patch)
tree0a25f1f328ca66177c79afcf4422ea99d221f981 /src/core.cpp
parentMerge pull request #4297 (diff)
parentestimatefee / estimatepriority RPC methods (diff)
downloaddiscoin-95d68c48d7ae45cb2a7303152816e9391cfbd0c9.tar.xz
discoin-95d68c48d7ae45cb2a7303152816e9391cfbd0c9.zip
Merge pull request #3959
171ca77 estimatefee / estimatepriority RPC methods (Gavin Andresen) 0193fb8 Allow multiple regression tests to run at once (Gavin Andresen) c6cb21d Type-safe CFeeRate class (Gavin Andresen)
Diffstat (limited to 'src/core.cpp')
-rw-r--r--src/core.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core.cpp b/src/core.cpp
index aadcb44b9..6039986e6 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -72,6 +72,25 @@ void CTxOut::print() const
LogPrintf("%s\n", ToString());
}
+CFeeRate::CFeeRate(int64_t nFeePaid, size_t nSize)
+{
+ if (nSize > 0)
+ nSatoshisPerK = nFeePaid*1000/nSize;
+ else
+ nSatoshisPerK = 0;
+}
+
+int64_t CFeeRate::GetFee(size_t nSize)
+{
+ return nSatoshisPerK*nSize / 1000;
+}
+
+std::string CFeeRate::ToString() const
+{
+ std::string result = FormatMoney(nSatoshisPerK) + " BTC/kB";
+ return result;
+}
+
uint256 CTransaction::GetHash() const
{
return SerializeHash(*this);