Remove in-band error signalling from SignatureHash, fixing the SIGHASH_SINGLE bug.

This commit is contained in:
Taylor Hornby
2016-07-11 17:00:04 -06:00
parent 85cc6f5b44
commit 67f0243533
6 changed files with 19 additions and 20 deletions

View File

@@ -25,7 +25,13 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
if (!keystore->GetKey(address, key))
return false;
uint256 hash = SignatureHash(scriptCode, *txTo, nIn, nHashType);
uint256 hash;
try {
hash = SignatureHash(scriptCode, *txTo, nIn, nHashType);
} catch (logic_error ex) {
return false;
}
if (!key.Sign(hash, vchSig))
return false;
vchSig.push_back((unsigned char)nHashType);