Skip to content

Commit e629d07

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 f4de89e commit e629d07

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
@@ -186,6 +186,8 @@ static CScript PushAll(const std::vector<valtype>& values)
186186
result << OP_0;
187187
} else if (v.size() == 1 && v[0] >= 1 && v[0] <= 16) {
188188
result << CScript::EncodeOP_N(v[0]);
189+
} else if (v.size() == 1 && v[0] == 0x81) {
190+
result << OP_1NEGATE;
189191
} else {
190192
result << v;
191193
}

src/test/transaction_tests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ static CScript PushAll(const std::vector<valtype>& values)
361361
result << OP_0;
362362
} else if (v.size() == 1 && v[0] >= 1 && v[0] <= 16) {
363363
result << CScript::EncodeOP_N(v[0]);
364+
} else if (v.size() == 1 && v[0] == 0x81) {
365+
result << OP_1NEGATE;
364366
} else {
365367
result << v;
366368
}

0 commit comments

Comments
 (0)