lightningd: Added loading of HTLCs upon startup

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2017-09-30 14:31:52 +02:00 committed by Rusty Russell
parent b4732f6091
commit c1493ae60c
2 changed files with 18 additions and 1 deletions

View file

@ -287,8 +287,14 @@ int main(int argc, char *argv[])
derive_peer_seed(ld, peer->seed, &peer->id, peer->channel->id);
peer->htlcs = tal_arr(peer, struct htlc_stub, 0);
peer->owner = NULL;
if (!wallet_htlcs_load_for_channel(ld->wallet, peer->channel,
&ld->htlcs_in, &ld->htlcs_out)) {
err(1, "could not load htlcs for channel: %s", ld->wallet->db->err);
}
}
if (!wallet_htlcs_reconnect(ld->wallet, &ld->htlcs_in, &ld->htlcs_out)) {
errx(1, "could not reconnect htlcs loaded from wallet, wallet may be inconsistent.");
}
/* Create RPC socket (if any) */
setup_jsonrpc(ld, ld->rpc_filename);

View file

@ -75,6 +75,17 @@ const char *version(void)
/* Generated stub for wallet_channels_load_active */
bool wallet_channels_load_active(struct wallet *w UNNEEDED, struct list_head *peers UNNEEDED)
{ fprintf(stderr, "wallet_channels_load_active called!\n"); abort(); }
/* Generated stub for wallet_htlcs_load_for_channel */
bool wallet_htlcs_load_for_channel(struct wallet *wallet UNNEEDED,
struct wallet_channel *chan UNNEEDED,
struct htlc_in_map *htlcs_in UNNEEDED,
struct htlc_out_map *htlcs_out UNNEEDED)
{ fprintf(stderr, "wallet_htlcs_load_for_channel called!\n"); abort(); }
/* Generated stub for wallet_htlcs_reconnect */
bool wallet_htlcs_reconnect(struct wallet *wallet UNNEEDED,
struct htlc_in_map *htlcs_in UNNEEDED,
struct htlc_out_map *htlcs_out UNNEEDED)
{ fprintf(stderr, "wallet_htlcs_reconnect called!\n"); abort(); }
/* Generated stub for wallet_new */
struct wallet *wallet_new(const tal_t *ctx UNNEEDED, struct log *log UNNEEDED)
{ fprintf(stderr, "wallet_new called!\n"); abort(); }