MCPcopy Create free account
hub / github.com/ElementsProject/elements / SignTransaction

Method SignTransaction

src/wallet/wallet.cpp:1858–1875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1856 */
1857
1858bool CWallet::SignTransaction(CMutableTransaction& tx) const
1859{
1860 AssertLockHeld(cs_wallet);
1861
1862 // Build coins map
1863 std::map<COutPoint, Coin> coins;
1864 for (auto& input : tx.vin) {
1865 std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(input.prevout.hash);
1866 if(mi == mapWallet.end() || input.prevout.n >= mi->second.tx->vout.size()) {
1867 return false;
1868 }
1869 const CWalletTx& wtx = mi->second;
1870 int prev_height = wtx.state<TxStateConfirmed>() ? wtx.state<TxStateConfirmed>()->confirmed_block_height : 0;
1871 coins[input.prevout] = Coin(wtx.tx->vout[input.prevout.n], prev_height, wtx.IsCoinBase());
1872 }
1873 std::map<int, bilingual_str> input_errors;
1874 return SignTransaction(tx, coins, SIGHASH_DEFAULT, input_errors);
1875}
1876
1877bool CWallet::SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, bilingual_str>& input_errors) const
1878{

Callers 4

SignTransactionFunction · 0.45
spend.cppFile · 0.45
FillPSBTMethod · 0.45

Calls 7

findMethod · 0.80
SignTransactionFunction · 0.70
CoinClass · 0.50
endMethod · 0.45
sizeMethod · 0.45
IsCoinBaseMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected