diff options
author | fanquake <fanquake@gmail.com> | 2022-04-25 09:46:08 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-04-25 09:54:40 +0100 |
commit | aa54132bac3b604035dfc46823e3367c218f8510 (patch) | |
tree | 70dc749b4b99e2f6aadfec58c52979c1111ac7d1 /contrib | |
parent | b31ba3abf81c0770fd12ae59e25ba1e92ef45f05 (diff) | |
parent | 9f5ab670e7c8165f161ec44dbd95778c5515ece0 (diff) | |
download | bitcoin-aa54132bac3b604035dfc46823e3367c218f8510.tar.xz |
Merge bitcoin/bitcoin#24454: tests: Fix calculation of external input weights
9f5ab670e7c8165f161ec44dbd95778c5515ece0 tests: Use descriptor that requires both legacy and segwit (Andrew Chow)
8a04a386f75d099f4b9864b0cdf7f26442b5801f tests: Calculate input weight more accurately (Andrew Chow)
Pull request description:
The external input tests with specifying input weight would sometimes result in a test failure because it would add 2 to the calculated byte size in order to account for some of the variation in signature and script sizes. However 1 in 128 signatures are actually 1 byte smaller than we expect, so the difference between the actual signature size and our calculated size becomes 3 bytes which is outside of the tolerance of `assert_fee_amount` and would thus cause the test failure.
To resolve this, the 2 byte buffer is reduced to 1 byte, so in the above scenario, the difference is 2 bytes which is within the tolerance of `assert_fee_amount`. Additionally, instead of putting a fixed size that we assume is the correct size for the length of the compact size length prefix of data, we actually get the length of the compact size uint.
Lastly, the size calculation for a scriptWitness was simply incorrect and used fields that did not exist. This is fixed, and the test slightly modified so that it also produces a scriptWitness.
Fixes #24151
ACKs for top commit:
jonatack:
re-ACK 9f5ab670e7c8165f161ec44dbd95778c5515ece0
glozow:
code review ACK 9f5ab670e7c8165f161ec44dbd95778c5515ece0
Tree-SHA512: b7c7ffe8fb0c07bc9e72fbff1f9ef57ee01a57c56bf54b8873345c8b9572c3ce9402b24dc211910b478114a9e6420faef5a4bf8866f38c299971354e54ec4745
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions