aboutsummaryrefslogtreecommitdiff
path: root/src/core.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-09-24 14:11:17 +0200
committerPieter Wuille <sipa@ulyssis.org>2013-09-24 14:11:20 +0200
commit99740bab9c38837ab575fdc00343afa68d62ab68 (patch)
tree5197cf4992f5709cd8b2f861d234e81ae19f8d9b /src/core.h
parentfb8724ee6caa0e55bba9849d9a672b5467bcbc0f (diff)
downloadbitcoin-99740bab9c38837ab575fdc00343afa68d62ab68.tar.xz
Skip unspendable outputs in consistency check
Diffstat (limited to 'src/core.h')
-rw-r--r--src/core.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core.h b/src/core.h
index a8828324fa..ce21acd59e 100644
--- a/src/core.h
+++ b/src/core.h
@@ -390,11 +390,7 @@ public:
// construct a CCoins from a CTransaction, at a given height
CCoins(const CTransaction &tx, int nHeightIn) : fCoinBase(tx.IsCoinBase()), vout(tx.vout), nHeight(nHeightIn), nVersion(tx.nVersion) {
- BOOST_FOREACH(CTxOut &txout, vout) {
- if (txout.scriptPubKey.IsUnspendable())
- txout.SetNull();
- }
- Cleanup();
+ ClearUnspendable();
}
// empty constructor
@@ -408,6 +404,14 @@ public:
std::vector<CTxOut>().swap(vout);
}
+ void ClearUnspendable() {
+ BOOST_FOREACH(CTxOut &txout, vout) {
+ if (txout.scriptPubKey.IsUnspendable())
+ txout.SetNull();
+ }
+ Cleanup();
+ }
+
void swap(CCoins &to) {
std::swap(to.fCoinBase, fCoinBase);
to.vout.swap(vout);