aboutsummaryrefslogtreecommitdiff
path: root/src/primitives/transaction.h
diff options
context:
space:
mode:
authorzathras-crypto <zathrasc@gmail.com>2015-03-25 02:04:02 -0700
committerdexX7 <dexx@bitwatch.co>2015-07-18 17:31:55 +0200
commit0aad1f13b2430165062bf9436036c1222a8724da (patch)
tree6cc83f06f73b18462985b7d90e2cdd563c4708aa /src/primitives/transaction.h
parented789ceade71f19f04340a4041d7d3ef43c44086 (diff)
Exempt unspendable transaction outputs from dust checks
Since unspendable outputs can't be spent, there is no threshold at which it would be uneconomic to spend them. This primarily targets transaction outputs with `OP_RETURN`. --- Initially based on: commit 9cf0ae26350033d43d5dd3c95054c0d1b1641eda Author: zathras-crypto <zathrasc@gmail.com> Date: Wed Mar 25 02:04:02 2015 -0700 Changes: - cherry-picked on top of bitcoin:master - added RPC test for fundrawtransaction
Diffstat (limited to 'src/primitives/transaction.h')
-rw-r--r--src/primitives/transaction.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h
index 77326c64b0..84f7adddd1 100644
--- a/src/primitives/transaction.h
+++ b/src/primitives/transaction.h
@@ -146,10 +146,13 @@ public:
// which has units satoshis-per-kilobyte.
// If you'd pay more than 1/3 in fees
// to spend something, then we consider it dust.
- // A typical txout is 34 bytes big, and will
+ // A typical spendable txout is 34 bytes big, and will
// need a CTxIn of at least 148 bytes to spend:
- // so dust is a txout less than 546 satoshis
+ // so dust is a spendable txout less than 546 satoshis
// with default minRelayTxFee.
+ if (scriptPubKey.IsUnspendable())
+ return 0;
+
size_t nSize = GetSerializeSize(SER_DISK,0)+148u;
return 3*minRelayTxFee.GetFee(nSize);
}