mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-09 17:14:28 +01:00
onchain: Add message to notify about their_unilater/to-us outputs
This is the only case in which we don't respend to a simple keyindex'd pubkey, so we need to handle this for future spends. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
@@ -1276,6 +1276,14 @@ static void handle_irrevocably_resolved(struct peer *peer, const u8 *msg)
|
||||
free_peer(peer, "onchaind complete, forgetting peer");
|
||||
}
|
||||
|
||||
/**
|
||||
* onchain_add_utxo -- onchaind is telling us about a UTXO we own
|
||||
*/
|
||||
static void onchain_add_utxo(struct peer *peer, const u8 *msg)
|
||||
{
|
||||
/* FIXME(cdecker) Implement */
|
||||
}
|
||||
|
||||
static unsigned int onchain_msg(struct subd *sd, const u8 *msg, const int *fds)
|
||||
{
|
||||
enum onchain_wire_type t = fromwire_peektype(msg);
|
||||
@@ -1309,6 +1317,10 @@ static unsigned int onchain_msg(struct subd *sd, const u8 *msg, const int *fds)
|
||||
handle_irrevocably_resolved(sd->peer, msg);
|
||||
break;
|
||||
|
||||
case WIRE_ONCHAIN_ADD_UTXO:
|
||||
onchain_add_utxo(sd->peer, msg);
|
||||
break;
|
||||
|
||||
/* We send these, not receive them */
|
||||
case WIRE_ONCHAIN_INIT:
|
||||
case WIRE_ONCHAIN_SPENT:
|
||||
|
||||
@@ -1887,6 +1887,13 @@ static void handle_their_unilateral(const struct bitcoin_tx *tx,
|
||||
OUTPUT_TO_US, NULL, NULL, NULL);
|
||||
ignore_output(out);
|
||||
script[LOCAL] = NULL;
|
||||
|
||||
/* Tell the master that it will want to add
|
||||
* this UTXO to its outputs */
|
||||
wire_sync_write(REQ_FD, towire_onchain_add_utxo(
|
||||
tmpctx, txid, i,
|
||||
remote_per_commitment_point,
|
||||
tx->output[i].amount));
|
||||
continue;
|
||||
}
|
||||
if (script[REMOTE]
|
||||
|
||||
@@ -82,3 +82,10 @@ onchain_htlc_timeout,,htlc,struct htlc_stub
|
||||
|
||||
# onchaind->master: this peer can be forgotten
|
||||
onchain_all_irrevocably_resolved,5011
|
||||
|
||||
# onchaind->master: hey, I identified a UTXO you'll want to track
|
||||
onchain_add_utxo,5012
|
||||
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
|
||||
|
Reference in New Issue
Block a user