]> Untitled Git - bdk/commit
test: Fix P2WPKH_FAKE_WITNESS_SIZE
authorDaniela Brozzoni <danielabrozzoni@protonmail.com>
Tue, 2 Aug 2022 09:24:23 +0000 (11:24 +0200)
committerDaniela Brozzoni <danielabrozzoni@protonmail.com>
Tue, 2 Aug 2022 10:08:54 +0000 (12:08 +0200)
commit50af51da5a5c906d8bf660d35a4f922ceb996068
tree7695925187b04ab3382297605406c08241dfd9f0
parentae919061e2b341ae74c90f0133ba392e835cb4e1
test: Fix P2WPKH_FAKE_WITNESS_SIZE

We would previously push 108 bytes on a P2WPKH witness
to simulate signature + pubkey. This was wrong: we should push
106 bytes instead.
The max satisfaction size for a P2WPKH is 112 WU:
elements in witness (1 byte, 1WU) + OP_PUSH (1 byte, 1WU) +
pk (33 bytes, 33 WU) + OP_PUSH (1 byte, 1WU) + signature and sighash
(72 bytes, 72 WU) + scriptsig len (1 byte, 4WU)
We should push on the witness pk + signature and sighash. This is 105
WU. Since we push just once instead of twice, we add 1WU for the OP_PUSH
we are omitting.
src/wallet/mod.rs