From 09a0eb97793e78626f484c09aac547314d3fed4d Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Thu, 1 Oct 2020 15:10:49 +0300 Subject: [PATCH] #4 do not add empty redeem script name --- src/payments/p2sh.js | 3 ++- src/payments/p2wsh.js | 3 ++- ts_src/payments/p2sh.ts | 3 ++- ts_src/payments/p2wsh.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/payments/p2sh.js b/src/payments/p2sh.js index 42b1e23..0f46403 100644 --- a/src/payments/p2sh.js +++ b/src/payments/p2sh.js @@ -95,7 +95,8 @@ function p2sh(a, opts) { }); lazy.prop(o, 'name', () => { const nameParts = ['p2sh']; - if (o.redeem !== undefined) nameParts.push(o.redeem.name); + if (o.redeem !== undefined && o.redeem.name !== undefined) + nameParts.push(o.redeem.name); return nameParts.join('-'); }); if (opts.validate) { diff --git a/src/payments/p2wsh.js b/src/payments/p2wsh.js index f9ae90b..e100c6d 100644 --- a/src/payments/p2wsh.js +++ b/src/payments/p2wsh.js @@ -118,7 +118,8 @@ function p2wsh(a, opts) { }); lazy.prop(o, 'name', () => { const nameParts = ['p2wsh']; - if (o.redeem !== undefined) nameParts.push(o.redeem.name); + if (o.redeem !== undefined && o.redeem.name !== undefined) + nameParts.push(o.redeem.name); return nameParts.join('-'); }); // extended validation diff --git a/ts_src/payments/p2sh.ts b/ts_src/payments/p2sh.ts index 8a097bd..3b53fdc 100644 --- a/ts_src/payments/p2sh.ts +++ b/ts_src/payments/p2sh.ts @@ -118,7 +118,8 @@ export function p2sh(a: Payment, opts?: PaymentOpts): Payment { }); lazy.prop(o, 'name', () => { const nameParts = ['p2sh']; - if (o.redeem !== undefined) nameParts.push(o.redeem.name!); + if (o.redeem !== undefined && o.redeem.name !== undefined) + nameParts.push(o.redeem.name!); return nameParts.join('-'); }); diff --git a/ts_src/payments/p2wsh.ts b/ts_src/payments/p2wsh.ts index a72be94..6653448 100644 --- a/ts_src/payments/p2wsh.ts +++ b/ts_src/payments/p2wsh.ts @@ -132,7 +132,8 @@ export function p2wsh(a: Payment, opts?: PaymentOpts): Payment { }); lazy.prop(o, 'name', () => { const nameParts = ['p2wsh']; - if (o.redeem !== undefined) nameParts.push(o.redeem.name!); + if (o.redeem !== undefined && o.redeem.name !== undefined) + nameParts.push(o.redeem.name!); return nameParts.join('-'); });