diff options
author | Peter Todd <pete@petertodd.org> | 2014-12-25 03:12:17 -0500 |
---|---|---|
committer | Peter Todd <pete@petertodd.org> | 2014-12-25 03:18:40 -0500 |
commit | d78f0dafd520f481f909cca7e361a4e482cbea72 (patch) | |
tree | dddfac56a964994772ec72810c65869a4975932b /src/script/standard.cpp | |
parent | 4312c8fc1892fd01a59cbccffffbb5082e36b695 (diff) |
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"
}
Diffstat (limited to 'src/script/standard.cpp')
-rw-r--r-- | src/script/standard.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script/standard.cpp b/src/script/standard.cpp index d0e2250049..ce50e3aad8 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -18,7 +18,7 @@ typedef vector<unsigned char> valtype; unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY; -CScriptID::CScriptID(const CScript& in) : uint160(in.size() ? Hash160(in.begin(), in.end()) : 0) {} +CScriptID::CScriptID(const CScript& in) : uint160(Hash160(in.begin(), in.end())) {} const char* GetTxnOutputType(txnouttype t) { |