Improve marginal fee rate detection
This commit is contained in:
parent
bd4e223aed
commit
03255dd077
@ -83,11 +83,13 @@ class Audit {
|
|||||||
const tx = mempool[txid];
|
const tx = mempool[txid];
|
||||||
if (tx) {
|
if (tx) {
|
||||||
const fits = (tx.weight - displacedWeightRemaining) < 4000;
|
const fits = (tx.weight - displacedWeightRemaining) < 4000;
|
||||||
const feeMatches = tx.effectiveFeePerVsize >= lastFeeRate;
|
// 0.005 margin of error for any remaining vsize rounding issues
|
||||||
|
const feeMatches = tx.effectiveFeePerVsize >= (lastFeeRate - 0.005);
|
||||||
if (fits || feeMatches) {
|
if (fits || feeMatches) {
|
||||||
isDisplaced[txid] = true;
|
isDisplaced[txid] = true;
|
||||||
if (fits) {
|
if (fits) {
|
||||||
lastFeeRate = Math.min(lastFeeRate, tx.effectiveFeePerVsize);
|
// (tx.effectiveFeePerVsize * tx.vsize) / Math.ceil(tx.vsize) attempts to correct for vsize rounding in the simple non-CPFP case
|
||||||
|
lastFeeRate = Math.min(lastFeeRate, (tx.effectiveFeePerVsize * tx.vsize) / Math.ceil(tx.vsize));
|
||||||
}
|
}
|
||||||
if (tx.firstSeen == null || (now - (tx?.firstSeen || 0)) > PROPAGATION_MARGIN) {
|
if (tx.firstSeen == null || (now - (tx?.firstSeen || 0)) > PROPAGATION_MARGIN) {
|
||||||
displacedWeightRemaining -= tx.weight;
|
displacedWeightRemaining -= tx.weight;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user