Browse Source

startup: Reorder HTLC wiring on startup after the topology init

Since the hook needs to pass information about the current blockheight to the
plugin we need to first initialize the topology.
htlc_accepted_hook
Christian Decker 6 years ago
committed by Rusty Russell
parent
commit
f7bfe166a8
  1. 10
      lightningd/lightningd.c

10
lightningd/lightningd.c

@ -720,9 +720,6 @@ int main(int argc, char *argv[])
/*~ Initialize the transaction filter with our pubkeys. */
init_txfilter(ld->wallet, ld->owned_txfilter);
/*~ Pull peers, channels and HTLCs from db. */
load_channels_from_wallet(ld);
/*~ Get the blockheight we are currently at, UINT32_MAX is used to signal
* an uninitialized wallet and that we should start off of bitcoind's
* current height */
@ -747,6 +744,13 @@ int main(int argc, char *argv[])
setup_topology(ld->topology, &ld->timers,
min_blockheight, max_blockheight);
/*~ Pull peers, channels and HTLCs from db. Needs to happen after the
* topology is initialized since some decisions rely on being able to
* know the blockheight. */
db_begin_transaction(ld->wallet->db);
load_channels_from_wallet(ld);
db_commit_transaction(ld->wallet->db);
/*~ Now create the PID file: this errors out if there's already a
* daemon running, so we call before trying to create an RPC socket. */
pid_fd = pidfile_create(ld);

Loading…
Cancel
Save