11#!/usr/bin/env python3
2- # Copyright (c) 2017-2022 The Bitcoin Core developers
2+ # Copyright (c) 2017-present The Bitcoin Core developers
33# Distributed under the MIT software license, see the accompanying
44# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55"""Class for bitcoind node under test"""
@@ -209,7 +209,7 @@ def __del__(self):
209209 def __getattr__ (self , name ):
210210 """Dispatches any unrecognised messages to the RPC connection or a CLI instance."""
211211 if self .use_cli :
212- return getattr (RPCOverloadWrapper (self .cli , True ), name )
212+ return getattr (RPCOverloadWrapper (self .cli ), name )
213213 else :
214214 assert self .rpc_connected and self .rpc is not None , self ._node_msg ("Error: no RPC connection" )
215215 return getattr (RPCOverloadWrapper (self .rpc ), name )
@@ -374,7 +374,7 @@ def setmocktime(self, timestamp):
374374
375375 def get_wallet_rpc (self , wallet_name ):
376376 if self .use_cli :
377- return RPCOverloadWrapper (self .cli ("-rpcwallet={}" .format (wallet_name )), True )
377+ return RPCOverloadWrapper (self .cli ("-rpcwallet={}" .format (wallet_name )))
378378 else :
379379 assert self .rpc_connected and self .rpc , self ._node_msg ("RPC not connected" )
380380 wallet_path = "wallet/{}" .format (urllib .parse .quote (wallet_name ))
@@ -925,60 +925,56 @@ def send_cli(self, clicommand=None, *args, **kwargs):
925925 return cli_stdout .rstrip ("\n " )
926926
927927class RPCOverloadWrapper ():
928- def __init__ (self , rpc , cli = False ):
928+ def __init__ (self , rpc ):
929929 self .rpc = rpc
930- self .is_cli = cli
931930
932931 def __getattr__ (self , name ):
933932 return getattr (self .rpc , name )
934933
935- def createwallet_passthrough (self , * args , ** kwargs ):
936- return self .__getattr__ ("createwallet" )(* args , ** kwargs )
937-
938- def importprivkey (self , privkey , label = None , rescan = None ):
934+ def importprivkey (self , privkey , * , label = None , rescan = None ):
939935 wallet_info = self .getwalletinfo ()
940936 if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
941937 return self .__getattr__ ('importprivkey' )(privkey , label , rescan )
942938 desc = descsum_create ('combo(' + privkey + ')' )
943939 req = [{
944940 'desc' : desc ,
945941 'timestamp' : 0 if rescan else 'now' ,
946- 'label' : label if label else ''
942+ 'label' : label if label else '' ,
947943 }]
948944 import_res = self .importdescriptors (req )
949945 if not import_res [0 ]['success' ]:
950946 raise JSONRPCException (import_res [0 ]['error' ])
951947
952- def addmultisigaddress (self , nrequired , keys , label = None , address_type = None ):
948+ def addmultisigaddress (self , nrequired , keys , * , label = None , address_type = None ):
953949 wallet_info = self .getwalletinfo ()
954950 if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
955951 return self .__getattr__ ('addmultisigaddress' )(nrequired , keys , label , address_type )
956952 cms = self .createmultisig (nrequired , keys , address_type )
957953 req = [{
958954 'desc' : cms ['descriptor' ],
959955 'timestamp' : 0 ,
960- 'label' : label if label else ''
956+ 'label' : label if label else '' ,
961957 }]
962958 import_res = self .importdescriptors (req )
963959 if not import_res [0 ]['success' ]:
964960 raise JSONRPCException (import_res [0 ]['error' ])
965961 return cms
966962
967- def importpubkey (self , pubkey , label = None , rescan = None ):
963+ def importpubkey (self , pubkey , * , label = None , rescan = None ):
968964 wallet_info = self .getwalletinfo ()
969965 if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
970966 return self .__getattr__ ('importpubkey' )(pubkey , label , rescan )
971967 desc = descsum_create ('combo(' + pubkey + ')' )
972968 req = [{
973969 'desc' : desc ,
974970 'timestamp' : 0 if rescan else 'now' ,
975- 'label' : label if label else ''
971+ 'label' : label if label else '' ,
976972 }]
977973 import_res = self .importdescriptors (req )
978974 if not import_res [0 ]['success' ]:
979975 raise JSONRPCException (import_res [0 ]['error' ])
980976
981- def importaddress (self , address , label = None , rescan = None , p2sh = None ):
977+ def importaddress (self , address , * , label = None , rescan = None , p2sh = None ):
982978 wallet_info = self .getwalletinfo ()
983979 if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
984980 return self .__getattr__ ('importaddress' )(address , label , rescan , p2sh )
@@ -992,13 +988,13 @@ def importaddress(self, address, label=None, rescan=None, p2sh=None):
992988 reqs = [{
993989 'desc' : desc ,
994990 'timestamp' : 0 if rescan else 'now' ,
995- 'label' : label if label else ''
991+ 'label' : label if label else '' ,
996992 }]
997993 if is_hex and p2sh :
998994 reqs .append ({
999995 'desc' : descsum_create ('p2sh(raw(' + address + '))' ),
1000996 'timestamp' : 0 if rescan else 'now' ,
1001- 'label' : label if label else ''
997+ 'label' : label if label else '' ,
1002998 })
1003999 import_res = self .importdescriptors (reqs )
10041000 for res in import_res :
0 commit comments