Browse Source

lightningd: don't crash when txout lookup fails.

Gossipd already correctly handles the "empty output means lookup failed" case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
parent
commit
4b663e596a
  1. 9
      lightningd/gossip_control.c

9
lightningd/gossip_control.c

@ -60,9 +60,16 @@ static void got_txout(struct bitcoind *bitcoind,
const struct bitcoin_tx_output *output, const struct bitcoin_tx_output *output,
struct short_channel_id *scid) struct short_channel_id *scid)
{ {
const u8 *script;
/* output will be NULL if it wasn't found */ /* output will be NULL if it wasn't found */
if (output)
script = output->script;
else
script = NULL;
subd_send_msg(bitcoind->ld->gossip, subd_send_msg(bitcoind->ld->gossip,
towire_gossip_get_txout_reply(scid, scid, output->script)); towire_gossip_get_txout_reply(scid, scid, script));
tal_free(scid); tal_free(scid);
} }

Loading…
Cancel
Save