diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-03-25 17:00:00 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2020-01-30 23:55:36 -0500 |
commit | 19a354b11f85a3c6c81ff83bf702bf7a40cf5046 (patch) | |
tree | 92498c0bc6745e0eb18f2b41cbc5f7f0256f737a /test/functional/test_framework | |
parent | 3e1bf71064ccb98d0684753e844c80d6da421287 (diff) | |
download | bitcoin-19a354b11f85a3c6c81ff83bf702bf7a40cf5046.tar.xz |
Output a descriptor in createmultisig and addmultisigaddress
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r-- | test/functional/test_framework/descriptors.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/test_framework/descriptors.py b/test/functional/test_framework/descriptors.py index 29482ce01e..46b405749b 100644 --- a/test/functional/test_framework/descriptors.py +++ b/test/functional/test_framework/descriptors.py @@ -4,6 +4,8 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Utility functions related to output descriptors""" +import re + INPUT_CHARSET = "0123456789()[],'/*abcdefgh@:$%{}IJKLMNOPQRSTUVWXYZ&+-.;<=>?!^_|~ijklmnopqrstuvwxyzABCDEFGH`#\"\\ " CHECKSUM_CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" GENERATOR = [0xf5dee51989, 0xa9fdca3312, 0x1bab10e32d, 0x3706b1677a, 0x644d626ffd] @@ -53,3 +55,10 @@ def descsum_check(s, require=True): return False symbols = descsum_expand(s[:-9]) + [CHECKSUM_CHARSET.find(x) for x in s[-8:]] return descsum_polymod(symbols) == 1 + +def drop_origins(s): + '''Drop the key origins from a descriptor''' + desc = re.sub(r'\[.+?\]', '', s) + if '#' in s: + desc = desc[:desc.index('#')] + return descsum_create(desc) |