Based on #8451.
This is a code change that was suggested early on, but not included in the segwit PR to not invalidate review. It turns out to be simpler than what I had expected, and actually shortens the code.
Instead of a structure where all CTransaction
’s witness data was encapsulated under CTransaction::wit
, it is now inlined inside CTransaction::vin[x]
. This also reduces memory usage for witness-bearing transactions (as no separate vector for all CTxInWitness
es is needed) and serialization/deserialization time as a result. For non-witness transactions with more than 1 input, it increases memory usage.
I think it’s neat that it changes the verbose and often-repeated tx.wit.vtxinwit.size() > i ? &tx.wit.vtxinwit[i].scriptWitness : NULL
pattern in VerifyScript
calls to just &tx.vin[i].scriptWitness
.
This should have no effect on behaviour.