From 007a62a3695b6003ddb102e4af5c5cf57b78b5cf Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Wed, 1 Apr 2020 21:45:21 -0500 Subject: [PATCH] coin moves: handle ignored outputs Ignored outputs don't end up in the same 'resolved' pathway as other tracked outputs do, so we mark them as moved when proposed/broadcast instead of when resolved (since they'll never flow through as resolved) --- onchaind/onchaind.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/onchaind/onchaind.c b/onchaind/onchaind.c index ac780e228..f348ab160 100644 --- a/onchaind/onchaind.c +++ b/onchaind/onchaind.c @@ -808,8 +808,17 @@ static void proposal_meets_depth(struct tracked_output *out) onchain_txtype_to_wallet_txtype(out->proposal->tx_type)))); /* Don't wait for this if we're ignoring the tiny payment. */ - if (out->proposal->tx_type == IGNORING_TINY_PAYMENT) + if (out->proposal->tx_type == IGNORING_TINY_PAYMENT) { + struct bitcoin_txid txid; + struct amount_sat fees; + ignore_output(out); + /* log the coin movements here, since we're not + * going to wait til we hear about it */ + bitcoin_txid(out->proposal->tx, &txid); + fees = record_chain_fees_tx(&txid, out->proposal->tx); + record_channel_withdrawal_minus_fees(&txid, out, fees); + } /* Otherwise we will get a callback when it's in a block. */ } @@ -1606,6 +1615,12 @@ static void handle_preimage(const struct chainparams *chainparams, outs[i]->wscript, &tx_type, htlc_feerate); propose_resolution(outs[i], tx, 0, tx_type); + if (tx_type == IGNORING_TINY_PAYMENT) { + struct bitcoin_txid txid; + bitcoin_txid(tx, &txid); + record_htlc_fulfilled(&txid, outs[i], true); + } + } } }