Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_importmulti.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2014-2019 The Bitcoin Core developers | # Copyright (c) 2014-2019 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test the importmulti RPC.""" | """Test the importmulti RPC.""" | ||||
from test_framework import script | from test_framework.script import ( | ||||
CScript, | |||||
OP_NOP, | |||||
) | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import ( | from test_framework.util import ( | ||||
assert_equal, | assert_equal, | ||||
assert_greater_than, | assert_greater_than, | ||||
assert_raises_rpc_error, | assert_raises_rpc_error, | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
assert_equal(address_assert['ismine'], False) | assert_equal(address_assert['ismine'], False) | ||||
assert_equal(address_assert['timestamp'], timestamp) | assert_equal(address_assert['timestamp'], timestamp) | ||||
assert_equal(address_assert['ischange'], True) | assert_equal(address_assert['ischange'], True) | ||||
# Nonstandard scriptPubKey + !internal | # Nonstandard scriptPubKey + !internal | ||||
self.log.info( | self.log.info( | ||||
"Should not import a nonstandard scriptPubKey without internal flag") | "Should not import a nonstandard scriptPubKey without internal flag") | ||||
nonstandardScriptPubKey = address['scriptPubKey'] + \ | nonstandardScriptPubKey = address['scriptPubKey'] + \ | ||||
script.CScript([script.OP_NOP]).hex() | CScript([OP_NOP]).hex() | ||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress()) | address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress()) | ||||
result = self.nodes[1].importmulti([{ | result = self.nodes[1].importmulti([{ | ||||
"scriptPubKey": nonstandardScriptPubKey, | "scriptPubKey": nonstandardScriptPubKey, | ||||
"timestamp": "now", | "timestamp": "now", | ||||
}]) | }]) | ||||
assert_equal(result[0]['success'], False) | assert_equal(result[0]['success'], False) | ||||
assert_equal(result[0]['error']['code'], -8) | assert_equal(result[0]['error']['code'], -8) | ||||
assert_equal( | assert_equal( | ||||
▲ Show 20 Lines • Show All 397 Lines • Show Last 20 Lines |