| 16 | MutableTransactionSignatureCreator::MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, bool no_forkid, int nHashTypeIn) : txTo(txToIn), nIn(nInIn), no_forkid(no_forkid), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn) {} |
| 17 | |
| 18 | bool MutableTransactionSignatureCreator::CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& address, const CScript& scriptCode, SigVersion sigversion) const |
| 19 | { |
| 20 | CKey key; |
| 21 | if (!provider.GetKey(address, key)) |
| 22 | return false; |
| 23 | |
| 24 | // Signing with uncompressed keys is disabled in witness scripts |
| 25 | if (sigversion == SigVersion::WITNESS_V0 && !key.IsCompressed()) |
| 26 | return false; |
| 27 | |
| 28 | uint256 hash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, sigversion, no_forkid); |
| 29 | if (!key.Sign(hash, vchSig)) |
| 30 | return false; |
| 31 | vchSig.push_back((unsigned char)nHashType); |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | static bool GetCScript(const SigningProvider& provider, const SignatureData& sigdata, const CScriptID& scriptid, CScript& script) |
| 36 | { |
no test coverage detected