Skip to content

Commit

Permalink
Fixing RPC related functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
janus committed Jan 21, 2024
1 parent aed60ed commit b37dd5e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions test/functional/rpc_dumptxoutset.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ def run_test(self):
# Blockhash should be deterministic based on mocked time.
assert_equal(
out['base_hash'],
'09abf0e7b510f61ca6cf33bab104e9ee99b3528b371d27a2d4b39abb800fba7e')
'579688e1c37db76fb91df0e1cd876b8885bef8cd266a3fef25ea3227c7e28209')

# UTXO snapshot hash should be deterministic based on mocked time.
assert_equal(
sha256sum_file(str(expected_path)).hex(),
'b1bacb602eacf5fbc9a7c2ef6eeb0d229c04e98bdf0c2ea5929012cd0eae3830')
'bb5a2be762988a5d08c787c82e1e782efb6cf1a0544e95dbcb1cab338e510c8b')

assert_equal(
out['txoutset_hash'], '1f7e3befd45dc13ae198dfbb22869a9c5c4196f8e9ef9735831af1288033f890')
out['txoutset_hash'], '1f1493bf052e2c0fdd637c2fa3067bc2b36df0a6a9deffda60cf5d9698f990e6')
assert_equal(out['nchaintx'], 101)

# Specifying a path to an existing or invalid file will fail.
Expand Down
6 changes: 3 additions & 3 deletions test/functional/rpc_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def run_test(self):
self.test_generateblock()

def test_generatetoaddress(self):
self.generatetoaddress(self.nodes[0], 1, 'mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')
self.generatetoaddress(self.nodes[0], 1, 'rbgl1qqpmtreykaj2jphmyf3358sn3wudm6thfypzzut')
assert_raises_rpc_error(-5, "Invalid address", self.generatetoaddress, self.nodes[0], 1, '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')

def test_generateblock(self):
Expand All @@ -49,15 +49,15 @@ def test_generateblock(self):

self.log.info('Generate an empty block to a combo descriptor with compressed pubkey')
combo_key = '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'
combo_address = 'bcrt1qw508d6qejxtdg4y5r3zarvary0c5xw7kygt080'
combo_address = 'rbgl1qw508d6qejxtdg4y5r3zarvary0c5xw7kahx879'
hash = self.generateblock(node, 'combo(' + combo_key + ')', [])['hash']
block = node.getblock(hash, 2)
assert_equal(len(block['tx']), 1)
assert_equal(block['tx'][0]['vout'][0]['scriptPubKey']['address'], combo_address)

self.log.info('Generate an empty block to a combo descriptor with uncompressed pubkey')
combo_key = '0408ef68c46d20596cc3f6ddf7c8794f71913add807f1dc55949fa805d764d191c0b7ce6894c126fce0babc6663042f3dde9b0cf76467ea315514e5a6731149c67'
combo_address = 'mkc9STceoCcjoXEXe6cm66iJbmjM6zR9B2'
combo_address = 'Emahd6fU8JwGq9VrknyDkSkj8vtiNQSsoZ'
hash = self.generateblock(node, 'combo(' + combo_key + ')', [])['hash']
block = node.getblock(hash, 2)
assert_equal(len(block['tx']), 1)
Expand Down
4 changes: 2 additions & 2 deletions test/functional/rpc_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def test_addpeeraddress(self):

self.log.debug("Test that adding a valid address to the tried table succeeds")
assert_equal(node.addpeeraddress(address="1.2.3.4", tried=True, port=8333), {"success": True})
with node.assert_debug_log(expected_msgs=["Addrman checks started: new 0, tried 1, total 1"]):
with node.assert_debug_log(expected_msgs=["CheckAddrman: new 0, tried 1, total 1 started"]):
addrs = node.getnodeaddresses(count=0) # getnodeaddresses re-runs the addrman checks
assert_equal(len(addrs), 1)
assert_equal(addrs[0]["address"], "1.2.3.4")
Expand All @@ -324,7 +324,7 @@ def test_addpeeraddress(self):

self.log.debug("Test that adding a second address, this time to the new table, succeeds")
assert_equal(node.addpeeraddress(address="2.0.0.0", port=8333), {"success": True})
with node.assert_debug_log(expected_msgs=["Addrman checks started: new 1, tried 1, total 2"]):
with node.assert_debug_log(expected_msgs=["CheckAddrman: new 1, tried 1, total 2 started"]):
addrs = node.getnodeaddresses(count=0) # getnodeaddresses re-runs the addrman checks
assert_equal(len(addrs), 2)

Expand Down
4 changes: 2 additions & 2 deletions test/functional/rpc_rawtransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def raw_multisig_transaction_legacy_tests(self):
rawTx = self.nodes[0].decoderawtransaction(rawTxSigned['hex'])
self.sync_all()
self.generate(self.nodes[0], 1)
assert_equal(self.nodes[0].getbalance(), bal + Decimal('50.00000000') + Decimal('2.19000000')) # block reward + tx
assert_equal(self.nodes[0].getbalance(), bal + Decimal('200.00000000') + Decimal('2.19000000')) # block reward + tx

# 2of2 test for combining transactions
bal = self.nodes[2].getbalance()
Expand Down Expand Up @@ -583,7 +583,7 @@ def raw_multisig_transaction_legacy_tests(self):
rawTx2 = self.nodes[0].decoderawtransaction(rawTxComb)
self.sync_all()
self.generate(self.nodes[0], 1)
assert_equal(self.nodes[0].getbalance(), bal + Decimal('50.00000000') + Decimal('2.19000000')) # block reward + tx
assert_equal(self.nodes[0].getbalance(), bal + Decimal('200.00000000') + Decimal('2.19000000')) # block reward + tx


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion test/functional/tool_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def test_invalid_tool_commands_and_args(self):
locked_dir = self.nodes[0].wallets_path
error = 'Error initializing wallet database environment "{}"!'.format(locked_dir)
if self.options.descriptors:
error = "SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another BGLd?"
error = "SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another instance of Bitgesell Core?"
self.assert_raises_tool_error(
error,
'-wallet=' + self.default_wallet_name,
Expand Down
6 changes: 4 additions & 2 deletions test/functional/wallet_listdescriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def run_test(self):
'timestamp': TIME_GENESIS_BLOCK,
'active': False,
'range': [0, 0],
'next': 0},
'next': 0,
'next_index': 0},
],
}
assert_equal(expected, wallet.listdescriptors())
Expand All @@ -92,7 +93,8 @@ def run_test(self):
'timestamp': TIME_GENESIS_BLOCK,
'active': False,
'range': [0, 0],
'next': 0},
'next': 0,
'next_index': 0},
],
}
assert_equal(expected_private, wallet.listdescriptors(True))
Expand Down

0 comments on commit b37dd5e

Please sign in to comment.