#4 do not add empty redeem script name

This commit is contained in:
Vlad Stan 2020-10-01 15:10:49 +03:00
parent f1d04cec00
commit 09a0eb9779
4 changed files with 8 additions and 4 deletions

View file

@ -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) {

View file

@ -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

View file

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

View file

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