Skip to content

Commit c9b1b6d

Browse files
committed
Merge #723: Fix P2WPKH_SATISFACTION_SIZE in CS tests
cd07890 Fix P2WPKH_SATISFACTION_SIZE in CS tests (Daniela Brozzoni) Pull request description: Our costant for the P2WPKH satisfaction size was wrong: in 7ac87b8 we added 1 WU for the script sig len - but actually, that's 4WU! This resulted in P2WPKH_SATISFACTION_SIZE being equal to 109 instead of 112. This also adds a comment for better readability. ### Description ### Notes to the reviewers ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### New Features: * [ ] I've added tests for the new feature * [ ] I've added docs for the new feature * [ ] I've updated `CHANGELOG.md` #### Bugfixes: * [ ] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [ ] I'm linking the issue being fixed by this PR ACKs for top commit: csralvall: utACK cd07890 afilini: ACK cd07890 Tree-SHA512: 3e39735505e411392cf01885b5920443d23fa21d9c20cc7c8fdeaa2698df8bc2da86241b6c20f5e3f5941fe1a0aebe8f957d8145d4f9e7ad3f213e4658d6ea68
2 parents 588c17f + cd07890 commit c9b1b6d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/wallet/coin_selection.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,9 @@ mod test {
734734
use rand::seq::SliceRandom;
735735
use rand::{Rng, SeedableRng};
736736

737-
const P2WPKH_SATISFACTION_SIZE: usize = 73 + 33 + 2 + 1;
737+
// n. of items on witness (1WU) + signature len (1WU) + signature and sighash (72WU)
738+
// + pubkey len (1WU) + pubkey (33WU) + script sig len (1 byte, 4WU)
739+
const P2WPKH_SATISFACTION_SIZE: usize = 1 + 1 + 72 + 1 + 33 + 4;
738740

739741
const FEE_AMOUNT: u64 = 50;
740742

0 commit comments

Comments
 (0)