Skip to content

Commit 203974d

Browse files
committed
feat: correctly identify P2TR (pass eccLib to toOutputScript and fromOutputScript)
1 parent 7989b6a commit 203974d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/psbt.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class Psbt {
133133
address = (0, address_1.fromOutputScript)(
134134
output.script,
135135
this.opts.network,
136+
this.__CACHE.__EC_LIB,
136137
);
137138
} catch (_) {}
138139
return {
@@ -235,7 +236,11 @@ class Psbt {
235236
const { address } = outputData;
236237
if (typeof address === 'string') {
237238
const { network } = this.opts;
238-
const script = (0, address_1.toOutputScript)(address, network);
239+
const script = (0, address_1.toOutputScript)(
240+
address,
241+
network,
242+
this.__CACHE.__EC_LIB,
243+
);
239244
outputData = Object.assign(outputData, { script });
240245
}
241246
const c = this.__CACHE;

ts_src/psbt.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ export class Psbt {
190190
return this.__CACHE.__TX.outs.map(output => {
191191
let address;
192192
try {
193-
address = fromOutputScript(output.script, this.opts.network);
193+
address = fromOutputScript(
194+
output.script,
195+
this.opts.network,
196+
this.__CACHE.__EC_LIB,
197+
);
194198
} catch (_) {}
195199
return {
196200
script: cloneBuffer(output.script),
@@ -304,7 +308,7 @@ export class Psbt {
304308
const { address } = outputData as any;
305309
if (typeof address === 'string') {
306310
const { network } = this.opts;
307-
const script = toOutputScript(address, network);
311+
const script = toOutputScript(address, network, this.__CACHE.__EC_LIB);
308312
outputData = Object.assign(outputData, { script });
309313
}
310314
const c = this.__CACHE;

0 commit comments

Comments
 (0)