mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 07:34:21 +01:00
peer: save/load results in database.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -443,12 +443,19 @@ static void get_init_blockhash(struct lightningd_state *dstate, u32 blockcount,
|
||||
void *unused)
|
||||
{
|
||||
u32 start;
|
||||
struct peer *peer;
|
||||
|
||||
if (blockcount < 100)
|
||||
start = 0;
|
||||
else
|
||||
start = blockcount - 100;
|
||||
|
||||
/* If loaded from database, go back to earliest possible peer anchor. */
|
||||
list_for_each(&dstate->peers, peer, list) {
|
||||
if (peer->anchor.min_depth && peer->anchor.min_depth < start)
|
||||
start = peer->anchor.min_depth;
|
||||
}
|
||||
|
||||
/* Start topology from 100 blocks back. */
|
||||
bitcoind_getblockhash(dstate, start, get_init_block, int2ptr(start));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user