aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-04-24 18:27:00 -0400
committerGavin Andresen <gavinandresen@gmail.com>2013-05-03 10:52:09 -0400
commit8de9bb53af32f7f6b09c06f831f2c0a7b4e95303 (patch)
treeafb7c68d3fd15203308f38a47a3cc3875d476a2f /src/main.h
parentb8e1dc2e53b9d19df26a87686dfd435b3b346f9c (diff)
downloadbitcoin-8de9bb53af32f7f6b09c06f831f2c0a7b4e95303.tar.xz
Define dust transaction outputs, and make them non-standard
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.h b/src/main.h
index 24b2cb2aa6..8c1e6d265c 100644
--- a/src/main.h
+++ b/src/main.h
@@ -439,6 +439,24 @@ public:
return !(a == b);
}
+ size_t size() const
+ {
+ return sizeof(nValue)+scriptPubKey.size();
+ }
+
+ bool IsDust() const
+ {
+ // "Dust" is defined in terms of MIN_RELAY_TX_FEE, 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 32 bytes big, and will
+ // need a CTxIn of at least 148 bytes to spend,
+ // so dust is a txout less than 54 uBTC
+ // (5400 satoshis)
+ return ((nValue*1000)/(3*(size()+148)) < MIN_RELAY_TX_FEE);
+ }
+
std::string ToString() const
{
if (scriptPubKey.size() < 6)