MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / CreateSig

Method CreateSig

src/script/sign.cpp:18–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16MutableTransactionSignatureCreator::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
18bool 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
35static bool GetCScript(const SigningProvider& provider, const SignatureData& sigdata, const CScriptID& scriptid, CScript& script)
36{

Callers 1

CreateSigFunction · 0.45

Calls 5

SignMethod · 0.80
SignatureHashFunction · 0.70
GetKeyMethod · 0.45
IsCompressedMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected