Skip to content

Commit 45af54f

Browse files
sipameshcollider
andcommitted
Do not turn OP_1NEGATE in scriptSig into 0x0181 in signing code
Co-authored-by: Samuel Dobson <[email protected]>
1 parent e4382fb commit 45af54f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/script/sign.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ static CScript PushAll(const vector<valtype>& values)
129129
result << OP_0;
130130
} else if (v.size() == 1 && v[0] >= 1 && v[0] <= 16) {
131131
result << CScript::EncodeOP_N(v[0]);
132+
} else if (v.size() == 1 && v[0] == 0x81) {
133+
result << OP_1NEGATE;
132134
} else {
133135
result << v;
134136
}

src/test/transaction_tests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ static CScript PushAll(const vector<valtype>& values)
403403
result << OP_0;
404404
} else if (v.size() == 1 && v[0] >= 1 && v[0] <= 16) {
405405
result << CScript::EncodeOP_N(v[0]);
406+
} else if (v.size() == 1 && v[0] == 0x81) {
407+
result << OP_1NEGATE;
406408
} else {
407409
result << v;
408410
}

0 commit comments

Comments
 (0)