From 89f249211a32f198dedacf4fdaac9e8a24426842 Mon Sep 17 00:00:00 2001 From: Jeremiah Buddenhagen Date: Thu, 25 Jan 2018 16:14:37 -0800 Subject: [PATCH] Sign transactions with v0.10.4 compatibility --- src/script/sign.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/script/sign.cpp b/src/script/sign.cpp index dc50467d3..ef7099b2d 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -27,7 +27,13 @@ bool TransactionSignatureCreator::CreateSig(std::vector& vchSig, if (sigversion == SIGVERSION_WITNESS_V0 && !key.IsCompressed()) return false; - uint256 hash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, sigversion); + int tempHashType = nHashType; + if (sigversion != SIGVERSION_WITNESS_V0) { + // Compatibility with v0.10.4 requires not signing the tx comment + // Once v0.10.4 is sufficiently fazed out this should be removed + tempHashType |= SIGHASH_OMIT_TX_COMMENT; + } + uint256 hash = SignatureHash(scriptCode, *txTo, nIn, tempHashType, amount, sigversion); if (!key.Sign(hash, vchSig)) return false; vchSig.push_back((unsigned char)nHashType);