Skip to content

Commit d78f0da

Browse files
committed
Fix CScriptID(const CScript& in) in empty script case
Previously an empty script wouldn't be hashed, and CScriptID would be assigned the incorrect value of 0 instead. This bug can be seen in the RPC decodescript command: $ btc decodescript "" { "asm" : "", "type" : "nonstandard", "p2sh" : "31h1vYVSYuKP6AhS86fbRdMw9XHieotbST" } Correct output: $ btc decodescript "" { "asm" : "", "type" : "nonstandard", "p2sh" : "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy" }
1 parent 4312c8f commit d78f0da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/script/standard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ typedef vector<unsigned char> valtype;
1818

1919
unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY;
2020

21-
CScriptID::CScriptID(const CScript& in) : uint160(in.size() ? Hash160(in.begin(), in.end()) : 0) {}
21+
CScriptID::CScriptID(const CScript& in) : uint160(Hash160(in.begin(), in.end())) {}
2222

2323
const char* GetTxnOutputType(txnouttype t)
2424
{

0 commit comments

Comments
 (0)