Avoid creating very small utxos that would violate an assumption in test_non_standard_witness.
Fixes #11953
1411 | # the signatures as we go. 1412 | tx.vin.append(CTxIn(COutPoint(i.sha256, i.n), b"")) 1413 | - tx.vout.append(CTxOut(i.nValue, CScript([OP_TRUE]))) 1414 | tx.wit.vtxinwit.append(CTxInWitness()) 1415 | - sign_P2PK_witness_input(witness_program, tx, index, SIGHASH_SINGLE|SIGHASH_ANYONECANPAY, i.nValue, key) 1416 | + sign_P2PK_witness_input(witness_program, tx, index, SIGHASH_ALL|SIGHASH_ANYONECANPAY, i.nValue, key)
why this change?
It felt wrong to use SIGHASH_SINGLE with an out-of-bounds index.
ah, ok then comment could use an update a few lines up.
Oops! Thanks, will fix.
Avoid creating very small utxos that would violate an assumption in
test_non_standard_witness.
Tested ACk 35c2b1fe3b1a046bbd1bfaf1c178e838d047277a
Thanks!
utACK 35c2b1fe3b1a046bbd1bfaf1c178e838d047277a. Created a similar fix last year, but somehow forgot to submit it.
utACK 35c2b1fe3b1a046bbd1bfaf1c178e838d047277a. Change makes sense, but I couldn't figure out what problem the previous outputs caused in test_non_standard_witness.
In test_non_standard_witness, you subtract the fee at some point. Having really small outputs, this could lead to negative outputs, provoking the "bad-txns-vout-negative". The smallest observed value depends on the test run and the exception is hit very rarely non-deterministically.
Yes the PR comment makes it sound like it's a non-standard witness, rather than non-standard output.
utACK 35c2b1f