Skip to content

Commit 8976cc3

Browse files
committed
wallet: remove unused total arg from wallet_extract_owned_outputs.
No caller uses it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 68f3649 commit 8976cc3

File tree

9 files changed

+8
-33
lines changed

9 files changed

+8
-33
lines changed

lightningd/chaintopology.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ static void filter_block_txs(struct chain_topology *topo, struct block *b)
5050
{
5151
struct txfilter *filter = topo->bitcoind->ld->owned_txfilter;
5252
size_t i;
53-
struct amount_sat owned;
5453

5554
/* Now we see if any of those txs are interesting. */
5655
const size_t num_txs = tal_count(b->full_txs);
@@ -77,11 +76,10 @@ static void filter_block_txs(struct chain_topology *topo, struct block *b)
7776
}
7877
}
7978

80-
owned = AMOUNT_SAT(0);
8179
txid = b->txids[i];
8280
if (txfilter_match(filter, tx)) {
8381
wallet_extract_owned_outputs(topo->bitcoind->ld->wallet,
84-
tx->wtx, is_coinbase, &b->height, &owned);
82+
tx->wtx, is_coinbase, &b->height);
8583
wallet_transaction_add(topo->ld->wallet, tx->wtx,
8684
b->height, i);
8785
// invoice_check_onchain_payment(tx);

lightningd/channel_control.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ struct send_splice_info
484484
static void handle_tx_broadcast(struct send_splice_info *info)
485485
{
486486
struct lightningd *ld = info->channel->peer->ld;
487-
struct amount_sat unused;
488487
struct json_stream *response;
489488
struct bitcoin_txid txid;
490489
u8 *tx_bytes;
@@ -496,7 +495,7 @@ static void handle_tx_broadcast(struct send_splice_info *info)
496495
/* This might have spent UTXOs from our wallet */
497496
num_utxos = wallet_extract_owned_outputs(ld->wallet,
498497
info->final_tx->wtx, false,
499-
NULL, &unused);
498+
NULL);
500499
if (num_utxos)
501500
wallet_transaction_add(ld->wallet, info->final_tx->wtx, 0, 0);
502501

lightningd/dual_open_control.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,14 +1667,12 @@ static void handle_tx_broadcast(struct channel_send *cs)
16671667
struct command *cmd = channel->openchannel_signed_cmd;
16681668
struct json_stream *response;
16691669
struct bitcoin_txid txid;
1670-
struct amount_sat unused;
16711670
int num_utxos;
16721671

16731672
/* This might have spent UTXOs from our wallet */
16741673
num_utxos = wallet_extract_owned_outputs(ld->wallet,
16751674
/* FIXME: what txindex? */
1676-
wtx, false, NULL,
1677-
&unused);
1675+
wtx, false, NULL);
16781676
if (num_utxos)
16791677
wallet_transaction_add(ld->wallet, wtx, 0, 0);
16801678

lightningd/peer_control.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static struct bitcoin_tx *sign_and_send_last(const tal_t *ctx,
331331
tx = sign_last_tx(ctx, channel, last_tx, last_sig);
332332
bitcoin_txid(tx, &txid);
333333
wallet_transaction_add(ld->wallet, tx->wtx, 0, 0);
334-
wallet_extract_owned_outputs(ld->wallet, tx->wtx, false, NULL, NULL);
334+
wallet_extract_owned_outputs(ld->wallet, tx->wtx, false, NULL);
335335

336336
/* Remember anchor information for commit_tx_boost */
337337
adet = create_anchor_details(NULL, channel, tx);

lightningd/test/run-invoice-select-inchan.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -907,10 +907,6 @@ bool peer_start_channeld(struct channel *channel UNNEEDED,
907907
bool reconnected UNNEEDED,
908908
bool reestablish_only UNNEEDED)
909909
{ fprintf(stderr, "peer_start_channeld called!\n"); abort(); }
910-
/* Generated stub for peer_start_closingd */
911-
void peer_start_closingd(struct channel *channel UNNEEDED,
912-
struct peer_fd *peer_fd UNNEEDED)
913-
{ fprintf(stderr, "peer_start_closingd called!\n"); abort(); }
914910
/* Generated stub for peer_start_dualopend */
915911
bool peer_start_dualopend(struct peer *peer UNNEEDED, struct peer_fd *peer_fd UNNEEDED,
916912
struct channel *channel UNNEEDED)
@@ -1044,8 +1040,7 @@ void wallet_delete_peer_if_unused(struct wallet *w UNNEEDED, u64 peer_dbid UNNEE
10441040
/* Generated stub for wallet_extract_owned_outputs */
10451041
int wallet_extract_owned_outputs(struct wallet *w UNNEEDED, const struct wally_tx *tx UNNEEDED,
10461042
bool is_coinbase UNNEEDED,
1047-
const u32 *blockheight UNNEEDED,
1048-
struct amount_sat *total UNNEEDED)
1043+
const u32 *blockheight UNNEEDED)
10491044
{ fprintf(stderr, "wallet_extract_owned_outputs called!\n"); abort(); }
10501045
/* Generated stub for wallet_htlcs_load_in_for_channel */
10511046
bool wallet_htlcs_load_in_for_channel(struct wallet *wallet UNNEEDED,

wallet/test/run-wallet.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,6 @@ bool peer_start_channeld(struct channel *channel UNNEEDED,
929929
bool reconnected UNNEEDED,
930930
bool reestablish_only UNNEEDED)
931931
{ fprintf(stderr, "peer_start_channeld called!\n"); abort(); }
932-
/* Generated stub for peer_start_closingd */
933-
void peer_start_closingd(struct channel *channel UNNEEDED,
934-
struct peer_fd *peer_fd UNNEEDED)
935-
{ fprintf(stderr, "peer_start_closingd called!\n"); abort(); }
936932
/* Generated stub for peer_start_dualopend */
937933
bool peer_start_dualopend(struct peer *peer UNNEEDED, struct peer_fd *peer_fd UNNEEDED,
938934
struct channel *channel UNNEEDED)

wallet/wallet.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,13 +2914,10 @@ void wallet_confirm_tx(struct wallet *w,
29142914

29152915
int wallet_extract_owned_outputs(struct wallet *w, const struct wally_tx *wtx,
29162916
bool is_coinbase,
2917-
const u32 *blockheight,
2918-
struct amount_sat *total)
2917+
const u32 *blockheight)
29192918
{
29202919
int num_utxos = 0;
29212920

2922-
if (total)
2923-
*total = AMOUNT_SAT(0);
29242921
for (size_t i = 0; i < wtx->num_outputs; i++) {
29252922
const struct wally_tx_output *txout = &wtx->outputs[i];
29262923
struct utxo *utxo;
@@ -2983,12 +2980,6 @@ int wallet_extract_owned_outputs(struct wallet *w, const struct wally_tx *wtx,
29832980

29842981
outpointfilter_add(w->owned_outpoints, &utxo->outpoint);
29852982

2986-
if (total && !amount_sat_add(total, *total, utxo->amount))
2987-
fatal("Cannot add utxo output %zu/%zu %s + %s",
2988-
i, wtx->num_outputs,
2989-
fmt_amount_sat(tmpctx, *total),
2990-
fmt_amount_sat(tmpctx, utxo->amount));
2991-
29922983
wallet_annotate_txout(w, &utxo->outpoint, TX_WALLET_DEPOSIT, 0);
29932984
tal_free(utxo);
29942985
num_utxos++;

wallet/wallet.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,7 @@ u32 wallet_blocks_maxheight(struct wallet *w);
761761
*/
762762
int wallet_extract_owned_outputs(struct wallet *w, const struct wally_tx *tx,
763763
bool is_coinbase,
764-
const u32 *blockheight,
765-
struct amount_sat *total);
764+
const u32 *blockheight);
766765

767766
/**
768767
* wallet_htlc_save_in - store an htlc_in in the database

wallet/walletrpc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,6 @@ static void sendpsbt_done(struct bitcoind *bitcoind UNUSED,
960960
struct lightningd *ld = sending->cmd->ld;
961961
struct json_stream *response;
962962
struct bitcoin_txid txid;
963-
struct amount_sat change;
964963

965964
if (!success) {
966965
/* Unreserve the inputs again. */
@@ -987,7 +986,7 @@ static void sendpsbt_done(struct bitcoind *bitcoind UNUSED,
987986
wallet_transaction_add(ld->wallet, sending->wtx, 0, 0);
988987

989988
/* Extract the change output and add it to the DB */
990-
wallet_extract_owned_outputs(ld->wallet, sending->wtx, false, NULL, &change);
989+
wallet_extract_owned_outputs(ld->wallet, sending->wtx, false, NULL);
991990
wally_txid(sending->wtx, &txid);
992991

993992
for (size_t i = 0; i < sending->psbt->num_outputs; i++)

0 commit comments

Comments
 (0)