mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
chaintopology: always start 100 blocks back.
Since we panic when we see our root reorg out, even if we're not doing anything yet, restoring the 100 block margin is the simplest fix. Unfortunately this means adding a 100-block spacer in the tests, so things don't get confused. Fixes: #511 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
822a2cf030
commit
fb81e6c14b
@ -468,6 +468,13 @@ static void get_init_blockhash(struct bitcoind *bitcoind, u32 blockcount,
|
||||
if (blockcount < topo->first_blocknum)
|
||||
topo->first_blocknum = blockcount;
|
||||
|
||||
/* FIXME: Because we don't handle our root disappearing, we go
|
||||
* 100 blocks back */
|
||||
if (topo->first_blocknum < 100)
|
||||
topo->first_blocknum = 0;
|
||||
else
|
||||
topo->first_blocknum -= 100;
|
||||
|
||||
/* Get up to speed with topology. */
|
||||
bitcoind_getblockhash(bitcoind, topo->first_blocknum,
|
||||
get_init_block, topo);
|
||||
|
@ -224,6 +224,11 @@ class BaseLightningDTests(unittest.TestCase):
|
||||
if not ok:
|
||||
raise Exception("At least one lightning exited with unexpected non-zero return code")
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
"""We need 100 blocks between runs, since otherwise they might see the txs from a previous run, and get very confused!"""
|
||||
bitcoind.generate_block(100)
|
||||
|
||||
class LightningDTests(BaseLightningDTests):
|
||||
def connect(self):
|
||||
l1 = self.node_factory.get_node()
|
||||
|
Loading…
Reference in New Issue
Block a user