Skip to content

Commit d60a105

Browse files
committed
test: add coverage for the incremental budget sync flow.
Essentially a node dropping the budget data and waiting until any of the connected peers relays the complete budget data once more (this happens every 28 blocks in regtest).
1 parent 34e9c23 commit d60a105

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/functional/tiertwo_governance_sync_basic.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,25 @@ def run_test(self):
380380
assert_equal(len(self.nodes[i].getbudgetinfo()), 16)
381381
self.log.info("resync (2): budget data resynchronized successfully!")
382382

383+
# Let's now verify the remote budget data relay.
384+
# Drop the budget data and generate blocks until someone incrementally sync us
385+
# (this is done once every 28 blocks on regtest).
386+
self.log.info("Testing incremental sync from peers, dropping budget data...")
387+
self.remoteDMN1.cleanbudget(try_sync=False)
388+
assert_equal(self.remoteDMN1.getbudgetprojection(), []) # empty
389+
assert_equal(self.remoteDMN1.getbudgetinfo(), [])
390+
self.log.info("Generating blocks until someone syncs the node..")
391+
self.stake(40, [self.remoteOne, self.remoteTwo])
392+
time.sleep(5) # wait a little bit
393+
self.log.info("Checking budget sync..")
394+
for i in range(self.num_nodes):
395+
assert_equal(len(self.nodes[i].getbudgetinfo()), 16)
396+
self.check_vote_existence(firstProposal.name, self.mnOneCollateral.hash, "YES", True)
397+
self.check_vote_existence(firstProposal.name, self.mnTwoCollateral.hash, "YES", True)
398+
self.check_vote_existence(firstProposal.name, self.proRegTx1, "YES", True)
399+
self.check_budget_finalization_sync(3, "OK")
400+
self.log.info("Remote incremental sync succeeded")
401+
383402
# now let's verify that votes expire properly.
384403
# Drop one MN and one DMN
385404
self.log.info("expiring MN1..")

0 commit comments

Comments
 (0)