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('-'); });