Skip to content

Commit 2d4a3b9

Browse files
committed
Don't expose witness on Psbt.txInputs
1 parent e7345d5 commit 2d4a3b9

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/psbt.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ class Psbt {
115115
index: input.index,
116116
script: bufferutils_1.cloneBuffer(input.script),
117117
sequence: input.sequence,
118-
witness: input.witness.map(buffer => bufferutils_1.cloneBuffer(buffer)),
119118
}));
120119
}
121120
get txOutputs() {

ts_src/psbt.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Transaction as ITransaction,
1212
TransactionFromBuffer,
1313
TransactionInput,
14+
TransactionOutput,
1415
} from 'bip174/src/lib/interfaces';
1516
import { checkForInput } from 'bip174/src/lib/utils';
1617
import { fromOutputScript, toOutputScript } from './address';
@@ -24,7 +25,7 @@ import {
2425
import { bitcoin as btcNetwork, Network } from './networks';
2526
import * as payments from './payments';
2627
import * as bscript from './script';
27-
import { Input, Output, Transaction } from './transaction';
28+
import { Output, Transaction } from './transaction';
2829

2930
/**
3031
* These are the default arguments for a Psbt instance.
@@ -145,17 +146,16 @@ export class Psbt {
145146
this.setLocktime(locktime);
146147
}
147148

148-
get txInputs(): Input[] {
149+
get txInputs(): TransactionInput[] {
149150
return this.__CACHE.__TX.ins.map(input => ({
150151
hash: cloneBuffer(input.hash),
151152
index: input.index,
152153
script: cloneBuffer(input.script),
153154
sequence: input.sequence,
154-
witness: input.witness.map(buffer => cloneBuffer(buffer)),
155155
}));
156156
}
157157

158-
get txOutputs(): Output[] {
158+
get txOutputs(): TransactionOutput[] {
159159
return this.__CACHE.__TX.outs.map(output => ({
160160
script: cloneBuffer(output.script),
161161
value: output.value,

types/psbt.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Psbt as PsbtBase } from 'bip174';
2-
import { KeyValue, PsbtGlobalUpdate, PsbtInput, PsbtInputUpdate, PsbtOutput, PsbtOutputUpdate, TransactionInput } from 'bip174/src/lib/interfaces';
2+
import { KeyValue, PsbtGlobalUpdate, PsbtInput, PsbtInputUpdate, PsbtOutput, PsbtOutputUpdate, TransactionInput, TransactionOutput } from 'bip174/src/lib/interfaces';
33
import { Signer, SignerAsync } from './ecpair';
44
import { Network } from './networks';
5-
import { Input, Output, Transaction } from './transaction';
5+
import { Transaction } from './transaction';
66
/**
77
* Psbt class can parse and generate a PSBT binary based off of the BIP174.
88
* There are 6 roles that this class fulfills. (Explained in BIP174)
@@ -46,8 +46,8 @@ export declare class Psbt {
4646
readonly inputCount: number;
4747
version: number;
4848
locktime: number;
49-
readonly txInputs: Input[];
50-
readonly txOutputs: Output[];
49+
readonly txInputs: TransactionInput[];
50+
readonly txOutputs: TransactionOutput[];
5151
combine(...those: Psbt[]): this;
5252
clone(): Psbt;
5353
setMaximumFeeRate(satoshiPerByte: number): void;

0 commit comments

Comments
 (0)