aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_signer.py
diff options
context:
space:
mode:
authorsstone <fabrice.drouin@acinq.fr>2021-11-29 15:48:36 +0100
committersstone <fabrice.drouin@acinq.fr>2021-12-09 11:17:04 +0100
commit5493e925013245d5ad0f7ea8784fe07f531803d0 (patch)
tree20ee6a5da53efaa594278e4a91884f3953b07336 /test/functional/wallet_signer.py
parentb4f647fa36a3336774ab616048bc6709bdc59fa1 (diff)
downloadbitcoin-5493e925013245d5ad0f7ea8784fe07f531803d0.tar.xz
Check descriptors returned by external signers
Check that descriptors returned by external signers have been parsed properly when creating a new wallet.
Diffstat (limited to 'test/functional/wallet_signer.py')
-rwxr-xr-xtest/functional/wallet_signer.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/functional/wallet_signer.py b/test/functional/wallet_signer.py
index 6dadc57b1a..9e2db517b6 100755
--- a/test/functional/wallet_signer.py
+++ b/test/functional/wallet_signer.py
@@ -25,6 +25,13 @@ class WalletSignerTest(BitcoinTestFramework):
else:
return path
+ def mock_invalid_signer_path(self):
+ path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mocks', 'invalid_signer.py')
+ if platform.system() == "Windows":
+ return "py " + path
+ else:
+ return path
+
def set_test_params(self):
self.num_nodes = 2
# The experimental syscall sandbox feature (-sandbox) is not compatible with -signer (which
@@ -48,6 +55,11 @@ class WalletSignerTest(BitcoinTestFramework):
os.remove(os.path.join(node.cwd, "mock_result"))
def run_test(self):
+ self.test_valid_signer()
+ self.restart_node(1, [f"-signer={self.mock_invalid_signer_path()}", "-keypool=10"])
+ self.test_invalid_signer()
+
+ def test_valid_signer(self):
self.log.debug(f"-signer={self.mock_signer_path()}")
# Create new wallets for an external signer.
@@ -187,5 +199,10 @@ class WalletSignerTest(BitcoinTestFramework):
# )
# self.clear_mock_result(self.nodes[4])
+ def test_invalid_signer(self):
+ self.log.debug(f"-signer={self.mock_invalid_signer_path()}")
+ self.log.info('Test invalid external signer')
+ assert_raises_rpc_error(-1, "Invalid descriptor", self.nodes[1].createwallet, wallet_name='hww_invalid', disable_private_keys=True, descriptors=True, external_signer=True)
+
if __name__ == '__main__':
WalletSignerTest().main()