mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-11-02 18:26:43 +00:00
parse output descriptors with missing fingerprints in key origin information
This commit is contained in:
parent
7584bcf260
commit
3a2344f129
1 changed files with 2 additions and 2 deletions
|
@ -25,7 +25,7 @@ public class OutputDescriptor {
|
||||||
private static final Pattern XPUB_PATTERN = Pattern.compile("(\\[[^\\]]+\\])?(.(?:pub|prv)[^/\\,)]{100,112})(/[/\\d*'hH<>;]+)?");
|
private static final Pattern XPUB_PATTERN = Pattern.compile("(\\[[^\\]]+\\])?(.(?:pub|prv)[^/\\,)]{100,112})(/[/\\d*'hH<>;]+)?");
|
||||||
private static final Pattern PUBKEY_PATTERN = Pattern.compile("(\\[[^\\]]+\\])?(0[23][0-9a-fA-F]{32})");
|
private static final Pattern PUBKEY_PATTERN = Pattern.compile("(\\[[^\\]]+\\])?(0[23][0-9a-fA-F]{32})");
|
||||||
private static final Pattern MULTI_PATTERN = Pattern.compile("multi\\(([\\d+])");
|
private static final Pattern MULTI_PATTERN = Pattern.compile("multi\\(([\\d+])");
|
||||||
private static final Pattern KEY_ORIGIN_PATTERN = Pattern.compile("\\[([A-Fa-f0-9]{8})([/\\d'hH]+)\\]");
|
private static final Pattern KEY_ORIGIN_PATTERN = Pattern.compile("\\[([A-Fa-f0-9]{8})?([/\\d'hH]+)\\]");
|
||||||
private static final Pattern MULTIPATH_PATTERN = Pattern.compile("<([\\d*'hH;]+)>");
|
private static final Pattern MULTIPATH_PATTERN = Pattern.compile("<([\\d*'hH;]+)>");
|
||||||
private static final Pattern CHECKSUM_PATTERN = Pattern.compile("#([" + CHECKSUM_CHARSET + "]{8})$");
|
private static final Pattern CHECKSUM_PATTERN = Pattern.compile("#([" + CHECKSUM_CHARSET + "]{8})$");
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@ public class OutputDescriptor {
|
||||||
String keyOrigin = matcher.group(1);
|
String keyOrigin = matcher.group(1);
|
||||||
Matcher keyOriginMatcher = KEY_ORIGIN_PATTERN.matcher(keyOrigin);
|
Matcher keyOriginMatcher = KEY_ORIGIN_PATTERN.matcher(keyOrigin);
|
||||||
if(keyOriginMatcher.matches()) {
|
if(keyOriginMatcher.matches()) {
|
||||||
byte[] masterFingerprintBytes = Utils.hexToBytes(keyOriginMatcher.group(1));
|
byte[] masterFingerprintBytes = keyOriginMatcher.group(1) != null ? Utils.hexToBytes(keyOriginMatcher.group(1)) : new byte[4];
|
||||||
if(masterFingerprintBytes.length != 4) {
|
if(masterFingerprintBytes.length != 4) {
|
||||||
throw new IllegalArgumentException("Master fingerprint must be 4 bytes: " + Utils.bytesToHex(masterFingerprintBytes));
|
throw new IllegalArgumentException("Master fingerprint must be 4 bytes: " + Utils.bytesToHex(masterFingerprintBytes));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue