test: run CoinJoin RPC tests using blank wallet

This commit is contained in:
Kittywhiskers Van Gogh 2024-12-16 08:29:31 +00:00
parent 3d5dc160d8
commit ff29c62103
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -19,43 +19,51 @@ class CoinJoinTest(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
def run_test(self): def setup_nodes(self):
self.test_coinjoin_start_stop() self.add_nodes(self.num_nodes)
self.test_coinjoin_setamount() self.start_nodes()
self.test_coinjoin_setrounds()
def test_coinjoin_start_stop(self): def run_test(self):
node = self.nodes[0]
node.createwallet(wallet_name='w1', blank=True, disable_private_keys=False)
w1 = node.get_wallet_rpc('w1')
self.test_coinjoin_start_stop(w1)
self.test_coinjoin_setamount(w1)
self.test_coinjoin_setrounds(w1)
def test_coinjoin_start_stop(self, node):
# Start Mixing # Start Mixing
self.nodes[0].coinjoin("start") node.coinjoin('start')
# Get CoinJoin info # Get CoinJoin info
cj_info = self.nodes[0].getcoinjoininfo() cj_info = node.getcoinjoininfo()
# Ensure that it started properly # Ensure that it started properly
assert_equal(cj_info['enabled'], True) assert_equal(cj_info['enabled'], True)
assert_equal(cj_info['running'], True) assert_equal(cj_info['running'], True)
# Stop mixing # Stop mixing
self.nodes[0].coinjoin("stop") node.coinjoin('stop')
# Get CoinJoin info # Get CoinJoin info
cj_info = self.nodes[0].getcoinjoininfo() cj_info = node.getcoinjoininfo()
# Ensure that it stopped properly # Ensure that it stopped properly
assert_equal(cj_info['enabled'], True) assert_equal(cj_info['enabled'], True)
assert_equal(cj_info['running'], False) assert_equal(cj_info['running'], False)
def test_coinjoin_setamount(self): def test_coinjoin_setamount(self, node):
# Try normal values # Try normal values
self.nodes[0].setcoinjoinamount(50) node.setcoinjoinamount(50)
cj_info = self.nodes[0].getcoinjoininfo() cj_info = node.getcoinjoininfo()
assert_equal(cj_info['max_amount'], 50) assert_equal(cj_info['max_amount'], 50)
# Try large values # Try large values
self.nodes[0].setcoinjoinamount(1200000) node.setcoinjoinamount(1200000)
cj_info = self.nodes[0].getcoinjoininfo() cj_info = node.getcoinjoininfo()
assert_equal(cj_info['max_amount'], 1200000) assert_equal(cj_info['max_amount'], 1200000)
def test_coinjoin_setrounds(self): def test_coinjoin_setrounds(self, node):
# Try normal values # Try normal values
self.nodes[0].setcoinjoinrounds(5) node.setcoinjoinrounds(5)
cj_info = self.nodes[0].getcoinjoininfo() cj_info = node.getcoinjoininfo()
assert_equal(cj_info['max_rounds'], 5) assert_equal(cj_info['max_rounds'], 5)