Thanks for pointing this out. The background validation does not seem to finish in this case.
I am now testing with a new node n3
(in my local copy) to avoid the manual rollback to START_HEIGHT
(L207). Additionally, sync_blocks()
was throwing a timeout when reusing n2 for this test (not sure why).
Here’s the new approach I’m trying:
- The new node starts at
START_HEIGHT
(199).
- I generate a divergent chain from
START_HEIGHT
up to height 298 (< SNAPSHOT_BASE_HEIGHT
).
- I load the snapshot (height=299).
After loading the snapshot, I can see these two chain states:
0[{'blocks': 298, 'bestblockhash': '171f1d8af9371c9d54a3731f8befdfa6dd2fe553831970ddffdaeb0b93aa54d3', 'difficulty': Decimal('4.656542373906925E-10'), 'verificationprogress': 1, 'coins_db_cache_bytes': 7969177, 'coins_tip_cache_bytes': 438304768, 'validated': True}, {'blocks': 299, 'bestblockhash': '3bb7ce5eba0be48939b7a521ac1ba9316afee2c7bada3a0cca24188e6d7d96c0', 'difficulty': Decimal('4.656542373906925E-10'), 'verificationprogress': 1, 'coins_db_cache_bytes': 419430, 'coins_tip_cache_bytes': 23068672, 'snapshot_blockhash': '3bb7ce5eba0be48939b7a521ac1ba9316afee2c7bada3a0cca24188e6d7d96c0', 'validated': False}]
Next, I connect the nodes and ensure they all see the same tip:
0self.connect_nodes(0, 3)
1self.wait_until(lambda: n3.getchainstates()['chainstates'][-1]['blocks'] == FINAL_HEIGHT)
2self.sync_blocks(nodes=(self.nodes[0], n3))
After syncing, these are the chain states:
0[{'blocks': 298, 'bestblockhash': '171f1d8af9371c9d54a3731f8befdfa6dd2fe553831970ddffdaeb0b93aa54d3', 'difficulty': Decimal('4.656542373906925E-10'), 'verificationprogress': 1, 'coins_db_cache_bytes': 7969177, 'coins_tip_cache_bytes': 438304768, 'validated': True}, {'blocks': 399, 'bestblockhash': '193ad9344966a54125f4b8d3596572c356ca3dcc216b25b91cb0022fbf61c7e1', 'difficulty': Decimal('4.656542373906925E-10'), 'verificationprogress': 1, 'coins_db_cache_bytes': 419430, 'coins_tip_cache_bytes': 23068672, 'snapshot_blockhash': '3bb7ce5eba0be48939b7a521ac1ba9316afee2c7bada3a0cca24188e6d7d96c0', 'validated': False}]
It seems that the snapshot chain has now synced to the tip (height 399). However, this line times out after syncing the blocks:
self.wait_until(lambda: len(n3.getchainstates()['chainstates']) == 1)
I’m not sure if I’m doing something wrong or if there is indeed a bug where the divergent chain is not rewound. I will continue investigating.
Something to note here: if I follow the same process but I don’t generate any divergent chain, then the validation completes successfully.
Any directions on how to proceed with this would be appreciated.