Skip to content

Commit c8ec423

Browse files
committed
Merge bitcoin/bitcoin#33020: test: delete commented-out tests and add a test case in wallet_signer
da318fe test: delete commented out tests (naiyoma) 6d80e99 test: external signer returns invalid JSON response (naiyoma) Pull request description: I noticed that some test cases had been commented out in wallet_signer.py. This PR uncomments and modifies some of those test cases so that they can pass. bitcoin/bitcoin@dac74c6 -> deleting this assertion since multiple signers is being tested here https://github.com/bitcoin/bitcoin/blob/master/test/functional/wallet_signer.py#L273 bitcoin/bitcoin@1707c90 test when an external signer returns malformed or invalid JSON, which would trigger this error: → https://github.com/bitcoin/bitcoin/blob/master/src/common/run_command.cpp#L42 bitcoin/bitcoin@b961568 test importdescriptors with external signer ACKs for top commit: Sjors: ACK da318fe achow101: ACK da318fe theStack: ACK da318fe Tree-SHA512: 6416f83abed1923d72a8a83c5937e8f732e02b5396b5bd3fe868d28e8f3cb2bf55f3bcbc2ec8219302b55045fa1d9e7ce119b4e8bdea2df2103fede9f109eacf
2 parents 09f004b + da318fe commit c8ec423

File tree

1 file changed

+5
-38
lines changed

1 file changed

+5
-38
lines changed

test/functional/wallet_signer.py

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,12 @@ def test_valid_signer(self):
7878
assert_equal(not_hww.getwalletinfo()["external_signer"], False)
7979
assert_raises_rpc_error(-8, "Wallet flag is immutable: external_signer", not_hww.setwalletflag, "external_signer", True)
8080

81-
# assert_raises_rpc_error(-4, "Multiple signers found, please specify which to use", wallet_name='not_hww', disable_private_keys=True, external_signer=True)
8281

83-
# TODO: Handle error thrown by script
84-
# self.set_mock_result(self.nodes[1], "2")
85-
# assert_raises_rpc_error(-1, 'Unable to parse JSON',
86-
# self.nodes[1].createwallet, wallet_name='not_hww2', disable_private_keys=True, external_signer=False
87-
# )
88-
# self.clear_mock_result(self.nodes[1])
82+
self.set_mock_result(self.nodes[1], '0 {"invalid json"}')
83+
assert_raises_rpc_error(-1, 'Unable to parse JSON',
84+
self.nodes[1].createwallet, wallet_name='hww2', disable_private_keys=True, external_signer=True
85+
)
86+
self.clear_mock_result(self.nodes[1])
8987

9088
assert_equal(hww.getwalletinfo()["keypoolsize"], 40)
9189

@@ -168,31 +166,6 @@ def test_valid_signer(self):
168166
mock_tx = mock_psbt_signed["hex"]
169167
assert mock_wallet.testmempoolaccept([mock_tx])[0]["allowed"]
170168

171-
# # Create a new wallet and populate with specific public keys, in order
172-
# # to work with the mock signed PSBT.
173-
# self.nodes[1].createwallet(wallet_name="hww4", disable_private_keys=True, external_signer=True)
174-
# hww4 = self.nodes[1].get_wallet_rpc("hww4")
175-
#
176-
# descriptors = [{
177-
# "desc": "wpkh([00000001/84h/1h/0']tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/0/*)#x30uthjs",
178-
# "timestamp": "now",
179-
# "range": [0, 1],
180-
# "internal": False,
181-
# "watchonly": True,
182-
# "active": True
183-
# },
184-
# {
185-
# "desc": "wpkh([00000001/84h/1h/0']tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/*)#h92akzzg",
186-
# "timestamp": "now",
187-
# "range": [0, 0],
188-
# "internal": True,
189-
# "watchonly": True,
190-
# "active": True
191-
# }]
192-
193-
# result = hww4.importdescriptors(descriptors)
194-
# assert_equal(result[0], {'success': True})
195-
# assert_equal(result[1], {'success': True})
196169
assert_equal(hww.getwalletinfo()["txcount"], 1)
197170

198171
assert hww.testmempoolaccept([mock_tx])[0]["allowed"]
@@ -232,12 +205,6 @@ def test_valid_signer(self):
232205
assert_greater_than(res["fee"], res["origfee"])
233206
assert_equal(res["errors"], [])
234207

235-
# # Handle error thrown by script
236-
# self.set_mock_result(self.nodes[4], "2")
237-
# assert_raises_rpc_error(-1, 'Unable to parse JSON',
238-
# hww4.signerprocesspsbt, psbt_orig, "00000001"
239-
# )
240-
# self.clear_mock_result(self.nodes[4])
241208

242209
def test_disconnected_signer(self):
243210
self.log.info('Test disconnected external signer')

0 commit comments

Comments
 (0)