Skip to content

Commit b104d44

Browse files
committed
test: Remove RPCOverloadWrapper
With the legacy wallet now removed, these overloads are no longer needed.
1 parent 4d32c19 commit b104d44

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

test/functional/test_framework/test_node.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ def __del__(self):
208208
def __getattr__(self, name):
209209
"""Dispatches any unrecognised messages to the RPC connection or a CLI instance."""
210210
if self.use_cli:
211-
return getattr(RPCOverloadWrapper(self.cli), name)
211+
return getattr(self.cli, name)
212212
else:
213213
assert self.rpc_connected and self.rpc is not None, self._node_msg("Error: no RPC connection")
214-
return getattr(RPCOverloadWrapper(self.rpc), name)
214+
return getattr(self.rpc, name)
215215

216216
def start(self, extra_args=None, *, cwd=None, stdout=None, stderr=None, env=None, **kwargs):
217217
"""Start the node."""
@@ -373,11 +373,11 @@ def setmocktime(self, timestamp):
373373

374374
def get_wallet_rpc(self, wallet_name):
375375
if self.use_cli:
376-
return RPCOverloadWrapper(self.cli("-rpcwallet={}".format(wallet_name)))
376+
return self.cli("-rpcwallet={}".format(wallet_name))
377377
else:
378378
assert self.rpc_connected and self.rpc, self._node_msg("RPC not connected")
379379
wallet_path = "wallet/{}".format(urllib.parse.quote(wallet_name))
380-
return RPCOverloadWrapper(self.rpc / wallet_path)
380+
return self.rpc / wallet_path
381381

382382
def version_is_at_least(self, ver):
383383
return self.version is None or self.version >= ver
@@ -922,10 +922,3 @@ def send_cli(self, clicommand=None, *args, **kwargs):
922922
return json.loads(cli_stdout, parse_float=decimal.Decimal)
923923
except (json.JSONDecodeError, decimal.InvalidOperation):
924924
return cli_stdout.rstrip("\n")
925-
926-
class RPCOverloadWrapper():
927-
def __init__(self, rpc):
928-
self.rpc = rpc
929-
930-
def __getattr__(self, name):
931-
return getattr(self.rpc, name)

test/functional/wallet_migration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ def send_to_script(script, amount):
726726
send_to_script(script=script_sh_pkh, amount=2)
727727

728728
# Import script and check balance
729-
wallet.rpc.importaddress(address=script_pkh.hex(), label="raw_spk", rescan=True, p2sh=True)
729+
wallet.importaddress(address=script_pkh.hex(), label="raw_spk", rescan=True, p2sh=True)
730730
assert_equal(wallet.getbalances()['watchonly']['trusted'], 2)
731731

732732
# Craft wsh(pkh(key)) and send coins to it
@@ -735,7 +735,7 @@ def send_to_script(script, amount):
735735
send_to_script(script=script_wsh_pkh, amount=3)
736736

737737
# Import script and check balance
738-
wallet.rpc.importaddress(address=script_wsh_pkh.hex(), label="raw_spk2", rescan=True, p2sh=False)
738+
wallet.importaddress(address=script_wsh_pkh.hex(), label="raw_spk2", rescan=True, p2sh=False)
739739
assert_equal(wallet.getbalances()['watchonly']['trusted'], 5)
740740

741741
# Import sh(pkh()) script, by using importaddress(), with the p2sh flag enabled.
@@ -751,7 +751,7 @@ def send_to_script(script, amount):
751751
# Note: 'importaddress()' will add two scripts, a valid one sh(pkh()) and an invalid one 'sh(sh(pkh()))'.
752752
# Both of them will be stored with the same addressbook label. And only the latter one should
753753
# be discarded during migration. The first one must be migrated.
754-
wallet.rpc.importaddress(address=script_sh_pkh.hex(), label=label_sh_pkh, rescan=False, p2sh=True)
754+
wallet.importaddress(address=script_sh_pkh.hex(), label=label_sh_pkh, rescan=False, p2sh=True)
755755

756756
# Migrate wallet and re-check balance
757757
info_migration, wallet = self.migrate_and_get_rpc("raw_p2sh")

0 commit comments

Comments
 (0)