File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -298,8 +298,6 @@ inline void UnserializeTransaction(TxType& tx, Stream& s) {
298
298
tx.vin .clear ();
299
299
tx.vout .clear ();
300
300
tx.witness .SetNull ();
301
- const_cast <CTxWitness*>(&tx.witness )->vtxinwit .resize (tx.vin .size ());
302
- const_cast <CTxWitness*>(&tx.witness )->vtxoutwit .resize (tx.vout .size ());
303
301
/* Try to read the vin. In case the dummy is there, this will be read as an empty vector. */
304
302
s >> tx.vin ;
305
303
if (tx.vin .size () == 0 && fAllowWitness ) {
@@ -321,12 +319,16 @@ inline void UnserializeTransaction(TxType& tx, Stream& s) {
321
319
if ((flags & 1 ) && fAllowWitness ) {
322
320
/* The witness flag is present. */
323
321
flags ^= 1 ;
322
+ const_cast <CTxWitness*>(&tx.witness )->vtxinwit .resize (tx.vin .size ());
323
+ const_cast <CTxWitness*>(&tx.witness )->vtxoutwit .resize (tx.vout .size ());
324
324
s >> tx.witness ;
325
325
}
326
326
} else {
327
327
if ((flags & 1 ) && fAllowWitness ) {
328
328
/* The witness flag is present. */
329
329
flags ^= 1 ;
330
+ const_cast <CTxWitness*>(&tx.witness )->vtxinwit .resize (tx.vin .size ());
331
+ const_cast <CTxWitness*>(&tx.witness )->vtxoutwit .resize (tx.vout .size ());
330
332
for (size_t i = 0 ; i < tx.vin .size (); i++) {
331
333
s >> tx.witness .vtxinwit [i].scriptWitness .stack ;
332
334
// ELEMENTS:
You can’t perform that action at this time.
0 commit comments