Bugfix: Don't extend already extended transactions to not override the firstSeen property.

fixes #390
This commit is contained in:
softsimon 2021-03-19 19:10:11 +07:00
parent 5148de8f17
commit e688948e42
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -26,6 +26,11 @@ class TransactionUtils {
} }
private extendTransaction(transaction: IEsploraApi.Transaction): TransactionExtended { private extendTransaction(transaction: IEsploraApi.Transaction): TransactionExtended {
// @ts-ignore
if (transaction.vsize) {
// @ts-ignore
return transaction;
}
const feePerVbytes = Math.max(1, (transaction.fee || 0) / (transaction.weight / 4)); const feePerVbytes = Math.max(1, (transaction.fee || 0) / (transaction.weight / 4));
const transactionExtended: TransactionExtended = Object.assign({ const transactionExtended: TransactionExtended = Object.assign({
vsize: Math.round(transaction.weight / 4), vsize: Math.round(transaction.weight / 4),