diff --git a/src/psbt.js b/src/psbt.js index a3191b4..dab6dbc 100644 --- a/src/psbt.js +++ b/src/psbt.js @@ -73,23 +73,6 @@ class Psbt { const c = this.__CACHE; c.__TX = this.data.globalMap.unsignedTx.tx; if (this.data.inputs.length === 0) this.setVersion(2); - // set cache - this.unsignedTx = Buffer.from([]); - Object.defineProperty(this, 'unsignedTx', { - enumerable: true, - get() { - const buf = c.__TX_BUF_CACHE; - if (buf !== undefined) { - return buf; - } else { - c.__TX_BUF_CACHE = c.__TX.toBuffer(); - return c.__TX_BUF_CACHE; - } - }, - set(_data) { - c.__TX_BUF_CACHE = _data; - }, - }); // Make data hidden when enumerating const dpew = (obj, attr, enumerable, writable) => Object.defineProperty(obj, attr, { @@ -137,7 +120,6 @@ class Psbt { checkInputsForPartialSig(this.data.inputs, 'setVersion'); const c = this.__CACHE; c.__TX.version = version; - c.__TX_BUF_CACHE = undefined; c.__EXTRACTED_TX = undefined; return this; } @@ -146,7 +128,6 @@ class Psbt { checkInputsForPartialSig(this.data.inputs, 'setLocktime'); const c = this.__CACHE; c.__TX.locktime = locktime; - c.__TX_BUF_CACHE = undefined; c.__EXTRACTED_TX = undefined; return this; } @@ -158,7 +139,6 @@ class Psbt { throw new Error('Input index too high'); } c.__TX.ins[inputIndex].sequence = sequence; - c.__TX_BUF_CACHE = undefined; c.__EXTRACTED_TX = undefined; return this; } diff --git a/ts_src/psbt.ts b/ts_src/psbt.ts index 97f615f..14dca4b 100644 --- a/ts_src/psbt.ts +++ b/ts_src/psbt.ts @@ -96,7 +96,6 @@ export class Psbt { return psbt; } - unsignedTx: Buffer; private __CACHE: PsbtCache = { __NON_WITNESS_UTXO_TX_CACHE: [], __NON_WITNESS_UTXO_BUF_CACHE: [], @@ -115,24 +114,6 @@ export class Psbt { c.__TX = (this.data.globalMap.unsignedTx as PsbtTransaction).tx; if (this.data.inputs.length === 0) this.setVersion(2); - // set cache - this.unsignedTx = Buffer.from([]); - Object.defineProperty(this, 'unsignedTx', { - enumerable: true, - get(): Buffer { - const buf = c.__TX_BUF_CACHE; - if (buf !== undefined) { - return buf; - } else { - c.__TX_BUF_CACHE = c.__TX.toBuffer(); - return c.__TX_BUF_CACHE; - } - }, - set(_data: Buffer): void { - c.__TX_BUF_CACHE = _data; - }, - }); - // Make data hidden when enumerating const dpew = ( obj: any, @@ -174,7 +155,6 @@ export class Psbt { checkInputsForPartialSig(this.data.inputs, 'setVersion'); const c = this.__CACHE; c.__TX.version = version; - c.__TX_BUF_CACHE = undefined; c.__EXTRACTED_TX = undefined; return this; } @@ -184,7 +164,6 @@ export class Psbt { checkInputsForPartialSig(this.data.inputs, 'setLocktime'); const c = this.__CACHE; c.__TX.locktime = locktime; - c.__TX_BUF_CACHE = undefined; c.__EXTRACTED_TX = undefined; return this; } @@ -197,7 +176,6 @@ export class Psbt { throw new Error('Input index too high'); } c.__TX.ins[inputIndex].sequence = sequence; - c.__TX_BUF_CACHE = undefined; c.__EXTRACTED_TX = undefined; return this; } @@ -533,7 +511,6 @@ interface PsbtCache { __NON_WITNESS_UTXO_BUF_CACHE: Buffer[]; __TX_IN_CACHE: { [index: string]: number }; __TX: Transaction; - __TX_BUF_CACHE?: Buffer; __FEE_RATE?: number; __EXTRACTED_TX?: Transaction; } diff --git a/types/psbt.d.ts b/types/psbt.d.ts index c3a12d0..2b24e65 100644 --- a/types/psbt.d.ts +++ b/types/psbt.d.ts @@ -41,7 +41,6 @@ export declare class Psbt { static fromBase64(data: string, opts?: PsbtOptsOptional): Psbt; static fromHex(data: string, opts?: PsbtOptsOptional): Psbt; static fromBuffer(buffer: Buffer, opts?: PsbtOptsOptional): Psbt; - unsignedTx: Buffer; private __CACHE; private opts; constructor(opts?: PsbtOptsOptional, data?: PsbtBase);