File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,16 @@ def run_test (self):
59
59
assert_equal (address_assert ['iswatchonly' ], True )
60
60
assert_equal (address_assert ['ismine' ], False )
61
61
62
+ print ("Should not import an invalid address" )
63
+ result = self .nodes [1 ].importmulti ([{
64
+ "scriptPubKey" : {
65
+ "address" : "not valid address" ,
66
+ },
67
+ "timestamp" : "now" ,
68
+ }])
69
+ assert_equal (result [0 ]['success' ], False )
70
+ assert_equal (result [0 ]['error' ]['code' ], - 5 )
71
+ assert_equal (result [0 ]['error' ]['message' ], 'Invalid address' )
62
72
63
73
# ScriptPubKey + internal
64
74
print ("Should import a scriptPubKey with internal flag" )
Original file line number Diff line number Diff line change @@ -671,6 +671,9 @@ UniValue processImport(const UniValue& data) {
671
671
672
672
if (!isScript) {
673
673
address = CBitcoinAddress (output);
674
+ if (!address.IsValid ()) {
675
+ throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Invalid address" );
676
+ }
674
677
script = GetScriptForDestination (address.Get ());
675
678
} else {
676
679
if (!IsHex (output)) {
You can’t perform that action at this time.
0 commit comments