diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2016-08-04 02:49:16 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-12-04 23:47:12 -0800 |
commit | f6fb7acda4aefd01b8ef6cd77063bfc0c4f4ab36 (patch) | |
tree | 311a5d4ee2b12057eb6cab17a0226f17cdc53eef /src/core_memusage.h | |
parent | d04aebaec7bbf4095bd4f6a715eb6ee834857115 (diff) |
Move CTxInWitness inside CTxIn
Diffstat (limited to 'src/core_memusage.h')
-rw-r--r-- | src/core_memusage.h | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/core_memusage.h b/src/core_memusage.h index 0dcc24c40c..80f6216ee2 100644 --- a/src/core_memusage.h +++ b/src/core_memusage.h @@ -18,35 +18,19 @@ static inline size_t RecursiveDynamicUsage(const COutPoint& out) { } static inline size_t RecursiveDynamicUsage(const CTxIn& in) { - return RecursiveDynamicUsage(in.scriptSig) + RecursiveDynamicUsage(in.prevout); -} - -static inline size_t RecursiveDynamicUsage(const CTxOut& out) { - return RecursiveDynamicUsage(out.scriptPubKey); -} - -static inline size_t RecursiveDynamicUsage(const CScriptWitness& scriptWit) { - size_t mem = memusage::DynamicUsage(scriptWit.stack); - for (std::vector<std::vector<unsigned char> >::const_iterator it = scriptWit.stack.begin(); it != scriptWit.stack.end(); it++) { - mem += memusage::DynamicUsage(*it); + size_t mem = RecursiveDynamicUsage(in.scriptSig) + RecursiveDynamicUsage(in.prevout) + memusage::DynamicUsage(in.scriptWitness.stack); + for (std::vector<std::vector<unsigned char> >::const_iterator it = in.scriptWitness.stack.begin(); it != in.scriptWitness.stack.end(); it++) { + mem += memusage::DynamicUsage(*it); } return mem; } -static inline size_t RecursiveDynamicUsage(const CTxInWitness& txinwit) { - return RecursiveDynamicUsage(txinwit.scriptWitness); -} - -static inline size_t RecursiveDynamicUsage(const CTxWitness& txwit) { - size_t mem = memusage::DynamicUsage(txwit.vtxinwit); - for (std::vector<CTxInWitness>::const_iterator it = txwit.vtxinwit.begin(); it != txwit.vtxinwit.end(); it++) { - mem += RecursiveDynamicUsage(*it); - } - return mem; +static inline size_t RecursiveDynamicUsage(const CTxOut& out) { + return RecursiveDynamicUsage(out.scriptPubKey); } static inline size_t RecursiveDynamicUsage(const CTransaction& tx) { - size_t mem = memusage::DynamicUsage(tx.vin) + memusage::DynamicUsage(tx.vout) + RecursiveDynamicUsage(tx.wit); + size_t mem = memusage::DynamicUsage(tx.vin) + memusage::DynamicUsage(tx.vout); for (std::vector<CTxIn>::const_iterator it = tx.vin.begin(); it != tx.vin.end(); it++) { mem += RecursiveDynamicUsage(*it); } @@ -57,7 +41,7 @@ static inline size_t RecursiveDynamicUsage(const CTransaction& tx) { } static inline size_t RecursiveDynamicUsage(const CMutableTransaction& tx) { - size_t mem = memusage::DynamicUsage(tx.vin) + memusage::DynamicUsage(tx.vout) + RecursiveDynamicUsage(tx.wit); + size_t mem = memusage::DynamicUsage(tx.vin) + memusage::DynamicUsage(tx.vout); for (std::vector<CTxIn>::const_iterator it = tx.vin.begin(); it != tx.vin.end(); it++) { mem += RecursiveDynamicUsage(*it); } |