forked from townforge/townforge
functional_tests: test cancelling multiple nonces at once
This commit is contained in:
parent
2100c61285
commit
356cb2989a
@ -4547,6 +4547,25 @@ class CCTest():
|
||||
res = self.wallet[1].cc_give(account_public_key[2], [{'type': ITEM_LABOUR, 'amount': 6}])
|
||||
self.generate_blocks('TF1MM8HqWBathu8hS5mwMNHm1da3cZCzg2rkqWLKCxpUarKtPszP3MjiocrJeLvph4AghgYu1AXonCmckfEuyE8Q2FFm8jNdiz3', 1)
|
||||
|
||||
# test cancelling multiples nonces at once
|
||||
multiple_nonces = [3, 4, 5]
|
||||
for n in multiple_nonces:
|
||||
res = daemon.cc_is_nonce_used(n)
|
||||
assert not res.used # vanishingly unlikely
|
||||
res = daemon.cc_get_used_nonces()
|
||||
for n in multiple_nonces:
|
||||
assert len([x for x in res.nonces if x.nonce == n]) == 0
|
||||
self.wallet[2].cc_cancel_nonces(multiple_nonces)
|
||||
self.generate_blocks('TF1MM8HqWBathu8hS5mwMNHm1da3cZCzg2rkqWLKCxpUarKtPszP3MjiocrJeLvph4AghgYu1AXonCmckfEuyE8Q2FFm8jNdiz3', 1)
|
||||
for n in multiple_nonces:
|
||||
res = daemon.cc_is_nonce_used(n)
|
||||
assert res.used
|
||||
assert 'txid' not in res or res.txid == "" or res.txid == "0" * 64
|
||||
assert res.accounts == [account_id[2]]
|
||||
res = daemon.cc_get_used_nonces()
|
||||
for n in multiple_nonces:
|
||||
assert len([x for x in res.nonces if x.nonce == n]) == 1
|
||||
|
||||
def test_game_update(self):
|
||||
daemon = self.daemon
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user