diff options
author | Cozz Lovan <cozzlovan@yahoo.com> | 2014-07-23 14:34:36 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-13 11:04:18 +0100 |
commit | 292623adf59edea52b2927b3d67fd2ff7f997882 (patch) | |
tree | afec21b4e7ff1c2b551b060f5f435895d43d15d6 /src/primitives/transaction.h | |
parent | 90a43c1e93318584d5443b513c2c0e937acb966a (diff) |
Subtract fee from amount
Fixes #2724 and #1570.
Adds the
automatically-subtract-the-fee-from-the-amount-and-send-whats-left
feature to the GUI and RPC (sendtoaddress,sendmany).
Diffstat (limited to 'src/primitives/transaction.h')
-rw-r--r-- | src/primitives/transaction.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 1b5a47e0da..fdb8c50a46 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -134,7 +134,7 @@ public: uint256 GetHash() const; - bool IsDust(CFeeRate minRelayTxFee) const + CAmount GetDustThreshold(const CFeeRate &minRelayTxFee) const { // "Dust" is defined in terms of CTransaction::minRelayTxFee, // which has units satoshis-per-kilobyte. @@ -145,7 +145,12 @@ public: // so dust is a txout less than 546 satoshis // with default minRelayTxFee. size_t nSize = GetSerializeSize(SER_DISK,0)+148u; - return (nValue < 3*minRelayTxFee.GetFee(nSize)); + return 3*minRelayTxFee.GetFee(nSize); + } + + bool IsDust(const CFeeRate &minRelayTxFee) const + { + return (nValue < GetDustThreshold(minRelayTxFee)); } friend bool operator==(const CTxOut& a, const CTxOut& b) |