From 06ca0651b626eb6e500835e7d3cab9b3e43f3e38 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Thu, 25 Dec 2014 03:12:17 -0500 Subject: 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" } Rebased-From: d78f0dafd520f481f909cca7e361a4e482cbea72 Github-Pull: #5541 --- src/script/standard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/standard.cpp b/src/script/standard.cpp index ab6e6cde0d..6e2c465c86 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -18,7 +18,7 @@ typedef vector 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) { -- cgit v1.2.3