MCPcopy Create free account
hub / github.com/ElementsProject/lightning / record_wallet_spend

Function record_wallet_spend

lightningd/chaintopology.c:912–931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

910}
911
912static void record_wallet_spend(struct lightningd *ld,
913 const struct bitcoin_outpoint *outpoint,
914 const struct bitcoin_txid *txid,
915 u32 tx_blockheight)
916{
917 struct utxo *utxo;
918
919 /* Find the amount this was for */
920 utxo = wallet_utxo_get(tmpctx, ld->wallet, outpoint);
921 if (!utxo) {
922 log_broken(ld->log, "No record of utxo %s",
923 fmt_bitcoin_outpoint(tmpctx,
924 outpoint));
925 return;
926 }
927
928 wallet_save_chain_mvt(ld, new_coin_wallet_withdraw(tmpctx, txid, outpoint,
929 tx_blockheight,
930 utxo->amount, mk_mvt_tags(MVT_WITHDRAWAL)));
931}
932
933/**
934 * topo_update_spends -- Tell the wallet about all spent outpoints

Callers 1

topo_update_spendsFunction · 0.85

Calls 4

fmt_bitcoin_outpointFunction · 0.85
wallet_save_chain_mvtFunction · 0.85
new_coin_wallet_withdrawFunction · 0.85
wallet_utxo_getFunction · 0.50

Tested by

no test coverage detected