aboutsummaryrefslogtreecommitdiff
path: root/src/core.cpp
diff options
context:
space:
mode:
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 aadcb44b98..6039986e6c 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);