mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
onchaind: Pass the funding spend height through when adding a UTXO
This is necessary since we have onchaind tell us about the their_unilateral/to_us output, after it is already in a block. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
ba7341ec87
commit
5519717144
@ -220,6 +220,7 @@ static void handle_irrevocably_resolved(struct channel *channel, const u8 *msg)
|
||||
static void onchain_add_utxo(struct channel *channel, const u8 *msg)
|
||||
{
|
||||
struct utxo *u = tal(msg, struct utxo);
|
||||
u32 blockheight;
|
||||
u->close_info = tal(u, struct unilateral_close_info);
|
||||
|
||||
u->is_p2sh = true;
|
||||
@ -227,14 +228,14 @@ static void onchain_add_utxo(struct channel *channel, const u8 *msg)
|
||||
u->status = output_state_available;
|
||||
u->close_info->channel_id = channel->dbid;
|
||||
u->close_info->peer_id = channel->peer->id;
|
||||
u->blockheight = NULL;
|
||||
u->spendheight = NULL;
|
||||
|
||||
if (!fromwire_onchain_add_utxo(msg, &u->txid, &u->outnum,
|
||||
&u->close_info->commitment_point,
|
||||
&u->amount)) {
|
||||
&u->amount, &blockheight)) {
|
||||
fatal("onchaind gave invalid add_utxo message: %s", tal_hex(msg, msg));
|
||||
}
|
||||
u->blockheight = blockheight>0?&blockheight:NULL;
|
||||
|
||||
outpointfilter_add(channel->peer->ld->wallet->owned_outpoints, &u->txid, u->outnum);
|
||||
wallet_add_utxo(channel->peer->ld->wallet, u, p2wpkh);
|
||||
|
@ -2039,7 +2039,8 @@ static void handle_their_unilateral(const struct bitcoin_tx *tx,
|
||||
wire_sync_write(REQ_FD, towire_onchain_add_utxo(
|
||||
tmpctx, txid, i,
|
||||
remote_per_commitment_point,
|
||||
tx->output[i].amount));
|
||||
tx->output[i].amount,
|
||||
tx_blockheight));
|
||||
continue;
|
||||
}
|
||||
if (script[REMOTE]
|
||||
|
@ -87,3 +87,4 @@ onchain_add_utxo,,prev_out_tx,struct bitcoin_txid
|
||||
onchain_add_utxo,,prev_out_index,u32
|
||||
onchain_add_utxo,,per_commit_point,struct pubkey
|
||||
onchain_add_utxo,,value,u64
|
||||
onchain_add_utxo,,blockheight,u32
|
||||
|
|
Loading…
Reference in New Issue
Block a user