meshcollider
commented at 10:58 AM on October 21, 2019:
contributor
A rebase of #13084 which additionally modifies the test code (unaddressed in the original, assuming sipa is too busy to deal with this at the moment).
Relatively simple bugfix so it'd be good to have merged soon.
Turning OP_1NEGATE into 0x0181 results in a larger-than-necessary data push instead of just actually using the OP_1NEGATE opcode (0x4f). This fails the minimal push rule of BIP 62 and makes the result non-standard.
meshcollider added the label Wallet on Oct 21, 2019
laanwj
commented at 11:49 AM on October 21, 2019:
member
Empact
commented at 1:33 PM on October 21, 2019:
member
How about a test?
laanwj
commented at 11:12 AM on October 22, 2019:
member
How about a test?
The test is updated. If you want a new, separate test for this, I think that doesn't need to be in this PR.
Empact
commented at 11:55 AM on October 22, 2019:
member
It’s good practice to include a regression test with any bugfix, both to confirm the new behavior and to ensure the bug isn’t reintroduced.
MarcoFalke renamed this: Do not turn OP_1NEGATE in scriptSig into 0x0181 in signing code (sipa) wallet: Do not turn OP_1NEGATE in scriptSig into 0x0181 in signing code (sipa) on Oct 22, 2019
laanwj
commented at 9:54 AM on October 23, 2019:
member
The change in src/test/transaction_tests.cpp is supposed to do this…
practicalswift
commented at 2:02 PM on October 23, 2019:
contributor
Update OP to make it explicit what the consequences are of turning OP_1NEGATE in scriptSig into 0x0181 in signing code? :)
Empact
commented at 3:33 PM on October 23, 2019:
member
The change in src/test/transaction_tests.cpp is supposed to do this…
You can confirm that it doesn't exercise the change by compiling without the sign.cpp changes, running the tests and seeing they don't fail:
$ git co 201910_1negate_rebase
# revert sign.cpp changes
$ git diff
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index 7ff06e526..0ed92e8d5 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -181,8 +181,6 @@ static CScript PushAll(const std::vector<valtype>& values)
result << OP_0;
} else if (v.size() == 1 && v[0] >= 1 && v[0] <= 16) {
result << CScript::EncodeOP_N(v[0]);
- } else if (v.size() == 1 && v[0] == 0x81) {
- result << OP_1NEGATE;
} else {
result << v;
}
$ make
$ src/test/test_bitcoin
Running 373 test cases...
*** No errors detected
laanwj
commented at 10:06 AM on October 25, 2019:
member
You can confirm that it doesn't exercise the change by compiling without the sign.cpp changes, running the tests and seeing they don't fail:
Ok, wasn't aware of that, thanks.
laanwj added the label Bug on Nov 1, 2019
luke-jr
commented at 8:43 PM on November 9, 2019:
member
If this is rebased on top of e4382fbef56a0e04b0ed834e8b3a3a16f81db149, it is a clean merge to 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, and master ;)
luke-jr
commented at 8:45 PM on November 9, 2019:
member
I spent some time trying to find out what the test was actually testing but gave up for now. It seems the raw transaction parser used to change the 0x4F in the redeem script to 0x0181 in the script and that was fixed some time ago. It's really hard to figure out because errors from script evaluation seem to have changed as well. I might go back to this but the change is good.
fanquake referenced this in commit c0b1706964 on Aug 14, 2020
laanwj merged this on Aug 14, 2020
laanwj closed this on Aug 14, 2020
meshcollider deleted the branch on Aug 14, 2020
luke-jr referenced this in commit 534c9ef409 on Aug 15, 2020
sidhujag referenced this in commit f8f417028c on Aug 16, 2020
sidhujag referenced this in commit f593e66ad8 on Aug 16, 2020
luke-jr referenced this in commit faeca437f6 on Aug 17, 2020
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me