chaintopology: reduce how far back we start on testnet.

When initially reading the blockchain, we start 100 back from the
current block, or at the first block with a funding transaction,
whichever is earlier.

This slows testing slightly, so use whatever the "forever" value is
(10 on testnet, still 100 on mainnet).

make check -j12 times:
	Before:	7m52.005s
	After:  6m31.896s

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-11-10 23:53:48 +10:30
parent ce96812ef0
commit 716da21f85

View File

@ -483,10 +483,11 @@ static void get_init_blockhash(struct lightningd_state *dstate, u32 blockcount,
u32 start;
struct peer *peer;
if (blockcount < 100)
/* Start back before any reasonable forks. */
if (blockcount < dstate->config.forever_confirms)
start = 0;
else
start = blockcount - 100;
start = blockcount - dstate->config.forever_confirms;
/* If loaded from database, go back to earliest possible peer anchor. */
list_for_each(&dstate->peers, peer, list) {