Skip to content

Commit e70bdea

Browse files
chore(psbt): clone uses correct fromBuffer
Enables extension of Psbt to support other chains Ticket: BG-00000
1 parent 1987e4f commit e70bdea

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/psbt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class Psbt {
152152
}
153153
clone() {
154154
// TODO: more efficient cloning
155-
const res = Psbt.fromBuffer(this.data.toBuffer());
155+
const res = this.constructor.fromBuffer(this.data.toBuffer(), this.opts);
156156
res.opts = JSON.parse(JSON.stringify(this.opts));
157157
return res;
158158
}

ts_src/psbt.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ export class Psbt {
216216

217217
clone(): Psbt {
218218
// TODO: more efficient cloning
219-
const res = Psbt.fromBuffer(this.data.toBuffer());
219+
const res = (this.constructor as typeof Psbt).fromBuffer(
220+
this.data.toBuffer(),
221+
this.opts,
222+
);
220223
res.opts = JSON.parse(JSON.stringify(this.opts));
221224
return res;
222225
}

0 commit comments

Comments
 (0)