Replace (features & 4) with (features & 3) in the four decoding-case checks. The docstring specifies that the lower two bits (f & 3) select which of x1/x2/x3 are valid. Using (features & 4) limited the value to {0,4}, making cases 1 and 2 unreachable and bypassing proper gating when bit 4 (u >= p) was set. This aligns implementation with the documented behavior and ensures all four modes are exercised correctly.
BIP324: Fix features bitmask for decoding-case selection #1969
pull phrwlk wants to merge 1 commits into bitcoin:master from phrwlk:Boban changing 1 files +4 −4-
phrwlk commented at 9:52 AM on September 16, 2025: none
-
BIP324: Fix features bitmask for decoding-case selection e78b33205b
- jonatack added the label Pending acceptance on Sep 17, 2025
- jonatack added the label Bug fix on Sep 17, 2025
-
jonatack commented at 8:10 PM on September 17, 2025: member
ACK e78b33205b8557efdf8a5c8ab931cda6e2b77599
cc BIP authors @real-or-random @jonasschnelli @sipa @dhruv for sign-off
-
real-or-random commented at 11:15 AM on September 22, 2025: contributor
I think that change is correct, but then this PR will also need to update the pregenerated
packet_encoding_test_vectors.csv. - jonatack added the label PR Author action required on Sep 23, 2025
-
real-or-random commented at 12:33 PM on October 23, 2025: contributor
I think that change is correct, but then this PR will also need to update the pregenerated
packet_encoding_test_vectors.csv.See #2016
-
jonatack commented at 8:32 PM on October 23, 2025: member
Ok, closing in favor of #2016 that cherry-picks this commit and then updates the generated files per #1969 (comment) above.
- jonatack closed this on Oct 23, 2025