Browse Source

gossip_store: don't leave dangling channel_announce if we truncate.

(Or, if we crashed before we got to write out the channel_update).
It's a corner case, but one reported by @darosior and reproduced
on my test node (both with bad gossip_store due to previous iterations
of this patchset!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
htlc_accepted_hook
Rusty Russell 6 years ago
parent
commit
628b65fb40
  1. 10
      gossipd/gossip_store.c

10
gossipd/gossip_store.c

@ -624,10 +624,18 @@ truncate_nomsg:
status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Truncating store: %s", strerror(errno));
out:
gs->writable = true;
/* If we ever truncated, we might have a dangling channel_announce */
if (chan_ann) {
struct broadcastable bcast;
bcast.index = chan_ann_off;
status_unusual("Deleting un-updated channel_announcement @%"
PRIu64, chan_ann_off);
gossip_store_delete(gs, &bcast, WIRE_CHANNEL_ANNOUNCEMENT);
}
status_trace("total store load time: %"PRIu64" msec",
time_to_msec(time_between(time_now(), start)));
status_trace("gossip_store: Read %zu/%zu/%zu/%zu cannounce/cupdate/nannounce/cdelete from store (%zu deleted) in %"PRIu64" bytes",
stats[0], stats[1], stats[2], stats[3], gs->deleted,
gs->len);
gs->writable = true;
}

Loading…
Cancel
Save