diff --git a/src/script/sign.cpp b/src/script/sign.cpp index e4ec27688..d0ae52b3a 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -41,21 +41,18 @@ TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keysto bool TransactionSignatureCreator::CreateSig(std::vector& vchSig, const CKeyID& address, const CScript& scriptCode, uint32_t consensusBranchId, CKey *pprivKey, void *extraData) const { - CKey key; - fprintf(stderr,"createsig\n"); - if (pprivKey) - key = *pprivKey; - else if (!keystore || !keystore->GetKey(address, key)) - return false; - fprintf(stderr,"createsig2\n"); - - uint256 hash; + CKey key; uint256 hash; try { hash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, consensusBranchId); } catch (logic_error ex) { return false; } SIG_TXHASH = hash; + if (pprivKey) + key = *pprivKey; + else if (!keystore || !keystore->GetKey(address, key)) + return false; + if (scriptCode.IsPayToCryptoCondition()) { CC *cc = (CC *)extraData;