mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
onchaind: Store and annotate close transaction when we drop to chain
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
7f898aa2a4
commit
05dbf1a2a9
@ -394,7 +394,7 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
|
||||
u32 blockheight)
|
||||
{
|
||||
u8 *msg;
|
||||
struct bitcoin_txid our_last_txid;
|
||||
struct bitcoin_txid our_last_txid, txid;
|
||||
struct htlc_stub *stubs;
|
||||
struct lightningd *ld = channel->peer->ld;
|
||||
struct pubkey final_key;
|
||||
@ -442,6 +442,7 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
|
||||
return KEEP_WATCHING;
|
||||
}
|
||||
/* This could be a mutual close, but it doesn't matter. */
|
||||
bitcoin_txid(tx, &txid);
|
||||
bitcoin_txid(channel->last_tx, &our_last_txid);
|
||||
|
||||
/* We try to use normal feerate for onchaind spends. */
|
||||
|
@ -344,6 +344,7 @@ register_close_command(struct lightningd *ld,
|
||||
void drop_to_chain(struct lightningd *ld, struct channel *channel,
|
||||
bool cooperative)
|
||||
{
|
||||
struct bitcoin_txid txid;
|
||||
/* BOLT #2:
|
||||
*
|
||||
* - if `next_remote_revocation_number` is greater than expected
|
||||
@ -357,6 +358,9 @@ void drop_to_chain(struct lightningd *ld, struct channel *channel,
|
||||
" they have a future one");
|
||||
} else {
|
||||
sign_last_tx(channel);
|
||||
bitcoin_txid(channel->last_tx, &txid);
|
||||
wallet_transaction_add(ld->wallet, channel->last_tx, 0, 0);
|
||||
wallet_transaction_annotate(ld->wallet, &txid, channel->last_tx_type, channel->dbid);
|
||||
|
||||
/* Keep broadcasting until we say stop (can fail due to dup,
|
||||
* if they beat us to the broadcast). */
|
||||
@ -916,7 +920,6 @@ static enum watch_result funding_spent(struct channel *channel,
|
||||
|
||||
wallet_channeltxs_add(channel->peer->ld->wallet, channel,
|
||||
WIRE_ONCHAIN_INIT, &txid, 0, block->height);
|
||||
|
||||
return onchaind_funding_spent(channel, tx, block->height);
|
||||
}
|
||||
|
||||
|
@ -557,6 +557,10 @@ void wallet_peer_delete(struct wallet *w UNNEEDED, u64 peer_dbid UNNEEDED)
|
||||
/* Generated stub for wallet_total_forward_fees */
|
||||
struct amount_msat wallet_total_forward_fees(struct wallet *w UNNEEDED)
|
||||
{ fprintf(stderr, "wallet_total_forward_fees called!\n"); abort(); }
|
||||
/* Generated stub for wallet_transaction_add */
|
||||
void wallet_transaction_add(struct wallet *w UNNEEDED, const struct bitcoin_tx *tx UNNEEDED,
|
||||
const u32 blockheight UNNEEDED, const u32 txindex UNNEEDED)
|
||||
{ fprintf(stderr, "wallet_transaction_add called!\n"); abort(); }
|
||||
/* Generated stub for wallet_transaction_annotate */
|
||||
void wallet_transaction_annotate(struct wallet *w UNNEEDED,
|
||||
const struct bitcoin_txid *txid UNNEEDED, txtypes type UNNEEDED,
|
||||
|
Loading…
Reference in New Issue
Block a user