Fix RBF timestamps to always use seconds

This commit is contained in:
Mononaut 2023-05-11 08:57:12 -06:00
parent 17dd02ed4e
commit e5bef55d47
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -36,7 +36,7 @@ class RbfCache {
} }
const newTx = Common.stripTransaction(newTxExtended) as RbfTransaction; const newTx = Common.stripTransaction(newTxExtended) as RbfTransaction;
const newTime = newTxExtended.firstSeen || Date.now(); const newTime = newTxExtended.firstSeen || (Date.now() / 1000);
newTx.rbf = newTxExtended.vin.some((v) => v.sequence < 0xfffffffe); newTx.rbf = newTxExtended.vin.some((v) => v.sequence < 0xfffffffe);
this.txs.set(newTx.txid, newTxExtended); this.txs.set(newTx.txid, newTxExtended);
@ -59,7 +59,7 @@ class RbfCache {
} }
} }
} else { } else {
const replacedTime = replacedTxExtended.firstSeen || Date.now(); const replacedTime = replacedTxExtended.firstSeen || (Date.now() / 1000);
replacedTrees.push({ replacedTrees.push({
tx: replacedTx, tx: replacedTx,
time: replacedTime, time: replacedTime,
@ -74,7 +74,7 @@ class RbfCache {
const treeId = replacedTrees[0].tx.txid; const treeId = replacedTrees[0].tx.txid;
const newTree = { const newTree = {
tx: newTx, tx: newTx,
time: newTxExtended.firstSeen || Date.now(), time: newTime,
fullRbf, fullRbf,
replaces: replacedTrees replaces: replacedTrees
}; };