Handle non-standard output types in Psbt.txOutputs
This commit is contained in:
parent
85ee2a3c5d
commit
48967652ca
3 changed files with 26 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
|||
# 5.1.9
|
||||
__fixed__
|
||||
- Fixed errors for psbt.txOutputs getter (#1578)
|
||||
|
||||
# 5.1.8
|
||||
__fixed__
|
||||
- Throw errors when p2wsh or p2wpkh contain uncompressed pubkeys (#1573)
|
||||
|
|
12
src/psbt.js
12
src/psbt.js
|
@ -117,11 +117,17 @@ class Psbt {
|
|||
}));
|
||||
}
|
||||
get txOutputs() {
|
||||
return this.__CACHE.__TX.outs.map(output => ({
|
||||
return this.__CACHE.__TX.outs.map(output => {
|
||||
let address;
|
||||
try {
|
||||
address = address_1.fromOutputScript(output.script, this.opts.network);
|
||||
} catch (_) {}
|
||||
return {
|
||||
script: bufferutils_1.cloneBuffer(output.script),
|
||||
value: output.value,
|
||||
address: address_1.fromOutputScript(output.script, this.opts.network),
|
||||
}));
|
||||
address,
|
||||
};
|
||||
});
|
||||
}
|
||||
combine(...those) {
|
||||
this.data.combine(...those.map(o => o.data));
|
||||
|
|
|
@ -155,11 +155,17 @@ export class Psbt {
|
|||
}
|
||||
|
||||
get txOutputs(): TransactionOutput[] {
|
||||
return this.__CACHE.__TX.outs.map(output => ({
|
||||
return this.__CACHE.__TX.outs.map(output => {
|
||||
let address;
|
||||
try {
|
||||
address = fromOutputScript(output.script, this.opts.network);
|
||||
} catch (_) {}
|
||||
return {
|
||||
script: cloneBuffer(output.script),
|
||||
value: output.value,
|
||||
address: fromOutputScript(output.script, this.opts.network),
|
||||
}));
|
||||
address,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
combine(...those: Psbt[]): this {
|
||||
|
|
Loading…
Reference in a new issue