Remove VSize, can get from Transaction
This commit is contained in:
parent
139197e545
commit
14d10c74a5
4 changed files with 1 additions and 35 deletions
src
13
src/psbt.js
13
src/psbt.js
|
@ -154,7 +154,6 @@ class Psbt {
|
|||
addNonWitnessTxCache(this.__CACHE, input, inputIndex);
|
||||
}
|
||||
c.__FEE = undefined;
|
||||
c.__VSIZE = undefined;
|
||||
c.__FEE_RATE = undefined;
|
||||
c.__EXTRACTED_TX = undefined;
|
||||
return this;
|
||||
|
@ -174,7 +173,6 @@ class Psbt {
|
|||
const c = this.__CACHE;
|
||||
this.data.addOutput(outputData);
|
||||
c.__FEE = undefined;
|
||||
c.__VSIZE = undefined;
|
||||
c.__FEE_RATE = undefined;
|
||||
c.__EXTRACTED_TX = undefined;
|
||||
return this;
|
||||
|
@ -201,14 +199,6 @@ class Psbt {
|
|||
getFee() {
|
||||
return getTxCacheValue('__FEE', 'fee', this.data.inputs, this.__CACHE);
|
||||
}
|
||||
getVSize() {
|
||||
return getTxCacheValue(
|
||||
'__VSIZE',
|
||||
'virtual size',
|
||||
this.data.inputs,
|
||||
this.__CACHE,
|
||||
);
|
||||
}
|
||||
finalizeAllInputs() {
|
||||
utils_1.checkForInput(this.data.inputs, 0); // making sure we have at least one
|
||||
range(this.data.inputs.length).forEach(idx => this.finalizeInput(idx));
|
||||
|
@ -736,7 +726,6 @@ function getTxCacheValue(key, name, inputs, c) {
|
|||
throw new Error(`PSBT must be finalized to calculate ${name}`);
|
||||
if (key === '__FEE_RATE' && c.__FEE_RATE) return c.__FEE_RATE;
|
||||
if (key === '__FEE' && c.__FEE) return c.__FEE;
|
||||
if (key === '__VSIZE' && c.__VSIZE) return c.__VSIZE;
|
||||
let tx;
|
||||
let mustFinalize = true;
|
||||
if (c.__EXTRACTED_TX) {
|
||||
|
@ -748,7 +737,6 @@ function getTxCacheValue(key, name, inputs, c) {
|
|||
inputFinalizeGetAmts(inputs, tx, c, mustFinalize);
|
||||
if (key === '__FEE_RATE') return c.__FEE_RATE;
|
||||
else if (key === '__FEE') return c.__FEE;
|
||||
else if (key === '__VSIZE') return c.__VSIZE;
|
||||
}
|
||||
function getFinalScripts(
|
||||
script,
|
||||
|
@ -1150,7 +1138,6 @@ function inputFinalizeGetAmts(inputs, tx, cache, mustFinalize) {
|
|||
throw new Error('Outputs are spending more than Inputs');
|
||||
}
|
||||
const bytes = tx.virtualSize();
|
||||
cache.__VSIZE = bytes;
|
||||
cache.__FEE = fee;
|
||||
cache.__EXTRACTED_TX = tx;
|
||||
cache.__FEE_RATE = Math.floor(fee / bytes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue