mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
lighthningd: Make sure peer->htlcs is initialized
When loading from DB the list of htlcs was not being initialized which caused a segfault when the first commit came around, this fixes it. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
def3d77a70
commit
9c3ac38544
@@ -21,6 +21,7 @@
|
||||
#include <daemon/options.h>
|
||||
#include <daemon/routing.h>
|
||||
#include <daemon/timeout.h>
|
||||
#include <lightningd/onchain/onchain_wire.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <utils.h>
|
||||
@@ -265,11 +266,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Load peers from database */
|
||||
wallet_channels_load_active(ld->wallet, &ld->peers);
|
||||
|
||||
/* TODO(cdecker) Move this into common location for initialization */
|
||||
struct peer *peer;
|
||||
list_for_each(&ld->peers, peer, list) {
|
||||
populate_peer(ld, peer);
|
||||
peer->seed = tal(peer, struct privkey);
|
||||
derive_peer_seed(ld, peer->seed, &peer->id, peer->channel->id);
|
||||
peer->htlcs = tal_arr(peer, struct htlc_stub, 0);
|
||||
}
|
||||
|
||||
/* Create RPC socket (if any) */
|
||||
|
||||
Reference in New Issue
Block a user