|
20 | 20 | assert_true, |
21 | 21 | connect_nodes, |
22 | 22 | get_datadir_path, |
23 | | - satoshi_round, |
| 23 | + satoshi_round |
24 | 24 | ) |
25 | 25 | import shutil |
26 | 26 | import os |
@@ -235,11 +235,25 @@ def run_test(self): |
235 | 235 | self.check_vote_existence(firstProposal.name, self.mnOneCollateral.hash, "YES", True) |
236 | 236 | self.log.info("all good, MN1 vote accepted everywhere!") |
237 | 237 |
|
| 238 | + # before broadcast the second vote, let's drop the budget data of ownerOne. |
| 239 | + # so the node is forced to send a single proposal sync when the, now orphan, proposal vote is received. |
| 240 | + self.log.info("Testing single proposal re-sync based on an orphan vote, dropping budget data...") |
| 241 | + self.ownerOne.cleanbudget(try_sync=False) |
| 242 | + assert_equal(self.ownerOne.getbudgetprojection(), []) # empty |
| 243 | + assert_equal(self.ownerOne.getbudgetinfo(), []) |
| 244 | + |
238 | 245 | # now let's vote for the proposal with the second MN |
239 | 246 | self.log.info("Voting with MN2...") |
240 | 247 | voteResult = self.ownerTwo.mnbudgetvote("alias", firstProposal.proposalHash, "yes", self.masternodeTwoAlias, True) |
241 | 248 | assert_equal(voteResult["detail"][0]["result"], "success") |
242 | 249 |
|
| 250 | + # check orphan vote proposal re-sync |
| 251 | + self.log.info("checking orphan vote based proposal re-sync...") |
| 252 | + time.sleep(5) # wait a bit before check it |
| 253 | + self.check_proposal_existence(firstProposal.name, firstProposal.proposalHash) |
| 254 | + self.check_vote_existence(firstProposal.name, self.mnOneCollateral.hash, "YES", True) |
| 255 | + self.log.info("all good, orphan vote based proposal re-sync succeeded") |
| 256 | + |
243 | 257 | # check that the vote was accepted everywhere |
244 | 258 | self.stake(1, [self.remoteOne, self.remoteTwo]) |
245 | 259 | self.check_vote_existence(firstProposal.name, self.mnTwoCollateral.hash, "YES", True) |
@@ -288,22 +302,38 @@ def run_test(self): |
288 | 302 | self.check_budget_finalization_sync(0, "OK") |
289 | 303 |
|
290 | 304 | self.log.info("budget finalization synced!, now voting for the budget finalization..") |
| 305 | + # Connecting owner to all the other nodes. |
| 306 | + self.connect_to_all(self.ownerOnePos) |
291 | 307 |
|
292 | 308 | voteResult = self.ownerOne.mnfinalbudget("vote-many", budgetFinHash, True) |
293 | 309 | assert_equal(voteResult["detail"][0]["result"], "success") |
| 310 | + time.sleep(2) # wait a bit |
| 311 | + self.stake(2, [self.remoteOne, self.remoteTwo]) |
| 312 | + self.check_budget_finalization_sync(1, "OK") |
294 | 313 | self.log.info("Remote One voted successfully.") |
| 314 | + |
| 315 | + # before broadcast the second finalization vote, let's drop the budget data of remoteOne. |
| 316 | + # so the node is forced to send a single fin sync when the, now orphan, vote is received. |
| 317 | + self.log.info("Testing single fin re-sync based on an orphan vote, dropping budget data...") |
| 318 | + self.remoteOne.cleanbudget(try_sync=False) |
| 319 | + assert_equal(self.remoteOne.getbudgetprojection(), []) # empty |
| 320 | + assert_equal(self.remoteOne.getbudgetinfo(), []) |
| 321 | + |
| 322 | + # vote for finalization with MN2 and the DMN |
295 | 323 | voteResult = self.ownerTwo.mnfinalbudget("vote-many", budgetFinHash, True) |
296 | 324 | assert_equal(voteResult["detail"][0]["result"], "success") |
297 | 325 | self.log.info("Remote Two voted successfully.") |
298 | 326 | voteResult = self.remoteDMN1.mnfinalbudget("vote", budgetFinHash) |
299 | 327 | assert_equal(voteResult["detail"][0]["result"], "success") |
300 | 328 | self.log.info("DMN voted successfully.") |
| 329 | + time.sleep(2) # wait a bit |
301 | 330 | self.stake(2, [self.remoteOne, self.remoteTwo]) |
302 | 331 |
|
303 | 332 | self.log.info("checking finalization votes..") |
304 | 333 | self.check_budget_finalization_sync(3, "OK") |
| 334 | + self.log.info("orphan vote based finalization re-sync succeeded") |
305 | 335 |
|
306 | | - self.stake(8, [self.remoteOne, self.remoteTwo]) |
| 336 | + self.stake(6, [self.remoteOne, self.remoteTwo]) |
307 | 337 | addrInfo = self.miner.listreceivedbyaddress(0, False, False, firstProposal.paymentAddr) |
308 | 338 | assert_equal(addrInfo[0]["amount"], firstProposal.amountPerCycle) |
309 | 339 |
|
@@ -341,9 +371,7 @@ def run_test(self): |
341 | 371 | self.log.info("restarting node..") |
342 | 372 | self.start_node(self.ownerTwoPos) |
343 | 373 | self.ownerTwo.setmocktime(self.mocktime) |
344 | | - for i in range(self.num_nodes): |
345 | | - if i is not self.ownerTwoPos: |
346 | | - self.connect_nodes_bi(self.nodes, self.ownerTwoPos, i) |
| 374 | + self.connect_to_all(self.ownerTwoPos) |
347 | 375 | self.stake(2, [self.remoteOne, self.remoteTwo]) |
348 | 376 |
|
349 | 377 | self.log.info("syncing node..") |
|
0 commit comments