diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2020-02-19 14:33:37 +0100 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2021-02-23 14:34:31 +0100 |
commit | 245b4457cf9265190a05529a0a97e1cb258cca8a (patch) | |
tree | db47c62fb253880cbc1ed7b4284ac39b9782d5bc /test/functional/mocks | |
parent | 7ebc7c0215979c53b92a436acc8b5b607b8d735a (diff) | |
download | bitcoin-245b4457cf9265190a05529a0a97e1cb258cca8a.tar.xz |
rpc: signerdisplayaddress
Diffstat (limited to 'test/functional/mocks')
-rwxr-xr-x | test/functional/mocks/signer.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/mocks/signer.py b/test/functional/mocks/signer.py index aedab14cee..4036c785b3 100755 --- a/test/functional/mocks/signer.py +++ b/test/functional/mocks/signer.py @@ -37,6 +37,20 @@ def getdescriptors(args): })) +def displayaddress(args): + # Several descriptor formats are acceptable, so allowing for potential + # changes to InferDescriptor: + if args.fingerprint != "00000001": + return sys.stdout.write(json.dumps({"error": "Unexpected fingerprint", "fingerprint": args.fingerprint})) + + expected_desc = [ + "wpkh([00000001/84'/1'/0'/0/0]02c97dc3f4420402e01a113984311bf4a1b8de376cac0bdcfaf1b3ac81f13433c7)#0yneg42r" + ] + if args.desc not in expected_desc: + return sys.stdout.write(json.dumps({"error": "Unexpected descriptor", "desc": args.desc})) + + return sys.stdout.write(json.dumps({"address": "bcrt1qm90ugl4d48jv8n6e5t9ln6t9zlpm5th68x4f8g"})) + parser = argparse.ArgumentParser(prog='./signer.py', description='External signer mock') parser.add_argument('--fingerprint') parser.add_argument('--chain', default='main') @@ -51,6 +65,10 @@ parser_getdescriptors = subparsers.add_parser('getdescriptors') parser_getdescriptors.set_defaults(func=getdescriptors) parser_getdescriptors.add_argument('--account', metavar='account') +parser_displayaddress = subparsers.add_parser('displayaddress', help='display address on signer') +parser_displayaddress.add_argument('--desc', metavar='desc') +parser_displayaddress.set_defaults(func=displayaddress) + args = parser.parse_args() perform_pre_checks() |