diff --git a/gossipd/gossip.c b/gossipd/gossip.c index ab47975c7..c94a884ef 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -1813,8 +1813,9 @@ static struct io_plan *handle_txout_reply(struct io_conn *conn, { struct short_channel_id scid; u8 *outscript; + u64 satoshis; - if (!fromwire_gossip_get_txout_reply(msg, msg, &scid, &outscript)) + if (!fromwire_gossip_get_txout_reply(msg, msg, &scid, &satoshis, &outscript)) master_badmsg(WIRE_GOSSIP_GET_TXOUT_REPLY, msg); if (handle_pending_cannouncement(daemon->rstate, &scid, outscript)) diff --git a/gossipd/gossip_wire.csv b/gossipd/gossip_wire.csv index de2d620a9..fe47c5b99 100644 --- a/gossipd/gossip_wire.csv +++ b/gossipd/gossip_wire.csv @@ -191,6 +191,7 @@ gossip_get_txout,,short_channel_id,struct short_channel_id # master->gossipd here is the output, or empty if none. gossip_get_txout_reply,3118 gossip_get_txout_reply,,short_channel_id,struct short_channel_id +gossip_get_txout_reply,,satoshis,u64 gossip_get_txout_reply,,len,u16 gossip_get_txout_reply,,outscript,len*u8 diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 164c5ea75..976b8f14e 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -66,15 +66,19 @@ static void got_txout(struct bitcoind *bitcoind, struct short_channel_id *scid) { const u8 *script; + u64 satoshis = 0; /* output will be NULL if it wasn't found */ - if (output) + if (output) { script = output->script; - else + satoshis = output->amount; + } else { script = NULL; + } - subd_send_msg(bitcoind->ld->gossip, - towire_gossip_get_txout_reply(scid, scid, script)); + subd_send_msg( + bitcoind->ld->gossip, + towire_gossip_get_txout_reply(scid, scid, satoshis, script)); tal_free(scid); } @@ -92,8 +96,9 @@ static void get_txout(struct subd *gossip, const u8 *msg) op = wallet_outpoint_for_scid(gossip->ld->wallet, scid, scid); if (op) { - subd_send_msg(gossip, towire_gossip_get_txout_reply( - scid, scid, op->scriptpubkey)); + subd_send_msg(gossip, + towire_gossip_get_txout_reply( + scid, scid, op->satoshis, op->scriptpubkey)); tal_free(scid); } else { bitcoind_getoutput(gossip->ld->topology->bitcoind,