aboutsummaryrefslogtreecommitdiff
path: root/src/amount.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2016-04-03 13:44:01 +0200
committerMarcoFalke <falke.marco@gmail.com>2016-04-08 19:59:53 +0200
commitfa2da2cb607ba359231fccc9635abe7c8616de56 (patch)
tree1b6ce7e9c2fa24ecf3e6e7d1a573027310249da3 /src/amount.h
parent11114a69c86e9abf4dd7e88ac268f5d078f40913 (diff)
downloadbitcoin-fa2da2cb607ba359231fccc9635abe7c8616de56.tar.xz
[amount] Add support for negative fee rates
Currently negative fee rates are not supported on archs of 64-bit or more
Diffstat (limited to 'src/amount.h')
-rw-r--r--src/amount.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/amount.h b/src/amount.h
index 9aba6525c7..5e52f37f23 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -11,6 +11,7 @@
#include <stdlib.h>
#include <string>
+/** Amount in satoshis (Can be negative) */
typedef int64_t CAmount;
static const CAmount COIN = 100000000;
@@ -30,22 +31,24 @@ extern const std::string CURRENCY_UNIT;
static const CAmount MAX_MONEY = 21000000 * COIN;
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-/** Type-safe wrapper class for fee rates
- * (how much to pay based on transaction size)
+/**
+ * Fee rate in satoshis per kilobyte: CAmount / kB
*/
class CFeeRate
{
private:
CAmount nSatoshisPerK; // unit is satoshis-per-1,000-bytes
public:
+ /** Fee rate of 0 satoshis per kB */
CFeeRate() : nSatoshisPerK(0) { }
explicit CFeeRate(const CAmount& _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) { }
- CFeeRate(const CAmount& nFeePaid, size_t nSize);
+ /** Constructor for a fee rate in satoshis per kB. The size in bytes must not exceed (2^63 - 1)*/
+ CFeeRate(const CAmount& nFeePaid, size_t nBytes);
CFeeRate(const CFeeRate& other) { nSatoshisPerK = other.nSatoshisPerK; }
/**
* Return the fee in satoshis for the given size in bytes.
*/
- CAmount GetFee(size_t size) const;
+ CAmount GetFee(size_t nBytes) const;
/**
* Return the fee in satoshis for a size of 1000 bytes
*/