From ab5b376b72e47a710eff4d79402679b93b383a56 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Sun, 19 Sep 2021 13:47:20 +0000 Subject: [PATCH] SignatureHash: fix rangeproof hash for SIGHASH_RANGEPROOF The logic for computing the uncached version of the sighash changed during the 0.21 rebase, such that it no longer matched the cached version. As the changed hash is used during signing (not verification!), this was not a forking change (and our existing functional test would have caught such a forking change since it uses Python to independently compute the hash). But it still broke signing. Test in next commit. --- src/script/interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 9b96564502..211cae7e46 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -2755,7 +2755,7 @@ uint256 SignatureHash(const CScript& scriptCode, const T& txTo, unsigned int nIn hashOutputs = cacheready ? cache->hashOutputs : SHA256Uint256(GetOutputsSHA256(txTo)); if (fRangeproof) { - hashRangeproofs = cacheready ? cache->hashRangeproofs : SHA256Uint256(GetRangeproofsHash(txTo)); + hashRangeproofs = cacheready ? cache->hashRangeproofs : GetRangeproofsHash(txTo); } } else if ((nHashType & 0x1f) == SIGHASH_SINGLE && nIn < txTo.vout.size()) { CHashWriter ss(SER_GETHASH, 0);