mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
fix(tests): Bumps in wait_for_tx/instantlock (#5301)
## Issue being fixed or feature implemented 1. we need to move time forward to let invs being relayed 2. nNextInvSend in SendMessages can be bumped up to 30+ seconds into the future in rare cases make sure timeouts in tests are high enough to relay tx inv/wait for corresponding islock ## What was done? tl;dr: bump mocktime while waiting, wait longer extracted fixes from https://github.com/dashpay/dash/pull/5288 but I expect this to fix other sporadic test failures too ## How Has This Been Tested? tests are ok locally and in https://github.com/dashpay/dash/pull/5288 ## Breaking Changes n/a ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation **For repository code-owners and collaborators only** - [ ] I have assigned this pull request to a milestone
This commit is contained in:
parent
1664246f77
commit
fe1d7e083a
@ -1407,13 +1407,14 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
ret = {**decoded, **ret}
|
||||
return ret
|
||||
|
||||
def wait_for_tx(self, txid, node, expected=True, timeout=15):
|
||||
def wait_for_tx(self, txid, node, expected=True, timeout=60):
|
||||
def check_tx():
|
||||
try:
|
||||
self.bump_mocktime(1)
|
||||
return node.getrawtransaction(txid)
|
||||
except:
|
||||
return False
|
||||
if wait_until(check_tx, timeout=timeout, sleep=0.5, do_assert=expected) and not expected:
|
||||
if wait_until(check_tx, timeout=timeout, sleep=1, do_assert=expected) and not expected:
|
||||
raise AssertionError("waiting unexpectedly succeeded")
|
||||
|
||||
def create_islock(self, hextx, deterministic=False):
|
||||
@ -1446,13 +1447,14 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
|
||||
return islock
|
||||
|
||||
def wait_for_instantlock(self, txid, node, expected=True, timeout=15):
|
||||
def wait_for_instantlock(self, txid, node, expected=True, timeout=60):
|
||||
def check_instantlock():
|
||||
self.bump_mocktime(1)
|
||||
try:
|
||||
return node.getrawtransaction(txid, True)["instantlock"]
|
||||
except:
|
||||
return False
|
||||
if wait_until(check_instantlock, timeout=timeout, sleep=0.5, do_assert=expected) and not expected:
|
||||
if wait_until(check_instantlock, timeout=timeout, sleep=1, do_assert=expected) and not expected:
|
||||
raise AssertionError("waiting unexpectedly succeeded")
|
||||
|
||||
def wait_for_chainlocked_block(self, node, block_hash, expected=True, timeout=15):
|
||||
|
Loading…
Reference in New Issue
Block a user