Fix mempool bug where fees are mis-calculated when fSkipExpiry is used

This commit is contained in:
Jonathan "Duke" Leto
2019-10-22 18:14:35 -07:00
parent b32c5c2b3a
commit 02bdc9d657

View File

@@ -1950,17 +1950,18 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
} }
CAmount nValueOut = tx.GetValueOut(); CAmount nValueOut = tx.GetValueOut();
CAmount nFees = nValueIn-nValueOut; double dPriority = 0;
double dPriority = 0; CAmount nFees = 0;
if (!fSkipExpiry) if (!fSkipExpiry)
{ {
dPriority = view.GetPriority(tx, chainActive.Height()); dPriority = view.GetPriority(tx, chainActive.Height());
nFees = 0; nFees = nValueIn-nValueOut;
} }
if ( nValueOut > 777777*COIN && KOMODO_VALUETOOBIG(nValueOut - 777777*COIN) != 0 ) // some room for blockreward and txfees if ( nValueOut > 777777*COIN && KOMODO_VALUETOOBIG(nValueOut - 777777*COIN) != 0 ) // some room for blockreward and txfees
return state.DoS(100, error("AcceptToMemoryPool: GetValueOut too big"),REJECT_INVALID,"tx valueout is too big"); return state.DoS(100, error("AcceptToMemoryPool: GetValueOut too big"),REJECT_INVALID,"tx valueout is too big");
// Keep track of transactions that spend a coinbase, which we re-scan // Keep track of transactions that spend a coinbase, which we re-scan
// during reorgs to ensure COINBASE_MATURITY is still met. // during reorgs to ensure COINBASE_MATURITY is still met.
bool fSpendsCoinbase = false; bool fSpendsCoinbase = false;
@@ -1973,7 +1974,6 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
} }
} }
} }
//fprintf(stderr,"addmempool 5\n");
// Grab the branch ID we expect this transaction to commit to. We don't // Grab the branch ID we expect this transaction to commit to. We don't
// yet know if it does, but if the entry gets added to the mempool, then // yet know if it does, but if the entry gets added to the mempool, then