diff --git a/package-lock.json b/package-lock.json index d81f236..cf05857 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@bitcoinerlab/descriptors", - "version": "2.0.3", + "version": "2.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@bitcoinerlab/descriptors", - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "dependencies": { "@bitcoinerlab/miniscript": "^1.2.1", diff --git a/package.json b/package.json index f4d63f8..63e6080 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@bitcoinerlab/descriptors", "description": "This library parses and creates Bitcoin Miniscript Descriptors and generates Partially Signed Bitcoin Transactions (PSBTs). It provides PSBT finalizers and signers for single-signature, BIP32 and Hardware Wallets.", "homepage": "https://github.com/bitcoinerlab/descriptors", - "version": "2.0.3", + "version": "2.0.4", "author": "Jose-Luis Landabaso", "license": "MIT", "repository": { diff --git a/src/descriptors.ts b/src/descriptors.ts index 99cd3f3..5ff1370 100644 --- a/src/descriptors.ts +++ b/src/descriptors.ts @@ -267,18 +267,24 @@ export function DescriptorsFactory(ecc: TinySecp256k1Interface) { } try { payment = p2pkh({ output, network }); + isSegwit = false; } catch (e) {} try { payment = p2sh({ output, network }); + //undefined isSegwit. Cannot know from looking at the address. Could + //be sh(wpkh), sh(wsh) or a plain old sh(SCRIPT) } catch (e) {} try { payment = p2wpkh({ output, network }); + isSegwit = true; } catch (e) {} try { payment = p2wsh({ output, network }); + isSegwit = true; } catch (e) {} try { payment = p2tr({ output, network }); + isSegwit = true; } catch (e) {} if (!payment) { throw new Error(`Error: invalid address ${matchedAddress}`);