Skip to content

Commit 53e716e

Browse files
committed
[refactor] improve style for touched code
1 parent 174cb53 commit 53e716e

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/validation.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ class MemPoolAccept
489489
std::list<CTransactionRef> m_replaced_transactions;
490490

491491
bool m_replacement_transaction;
492-
CAmount m_fee_out;
492+
CAmount m_base_fees;
493493
CAmount m_modified_fees;
494494
CAmount m_conflicting_fees;
495495
size_t m_conflicting_size;
@@ -561,7 +561,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
561561
std::vector<COutPoint>& coins_to_uncache = args.m_coins_to_uncache;
562562

563563
// Alias what we need out of ws
564-
TxValidationState &state = ws.m_state;
564+
TxValidationState& state = ws.m_state;
565565
std::set<uint256>& setConflicts = ws.m_conflicts;
566566
CTxMemPool::setEntries& allConflicting = ws.m_all_conflicting;
567567
CTxMemPool::setEntries& setAncestors = ws.m_ancestors;
@@ -681,7 +681,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
681681
if (!CheckSequenceLocks(m_pool, tx, STANDARD_LOCKTIME_VERIFY_FLAGS, &lp))
682682
return state.Invalid(TxValidationResult::TX_PREMATURE_SPEND, "non-BIP68-final");
683683

684-
if (!Consensus::CheckTxInputs(tx, state, m_view, g_chainman.m_blockman.GetSpendHeight(m_view), ws.m_fee_out)) {
684+
if (!Consensus::CheckTxInputs(tx, state, m_view, g_chainman.m_blockman.GetSpendHeight(m_view), ws.m_base_fees)) {
685685
return false; // state filled in by CheckTxInputs
686686
}
687687

@@ -699,7 +699,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
699699
int64_t nSigOpsCost = GetTransactionSigOpCost(tx, m_view, STANDARD_SCRIPT_VERIFY_FLAGS);
700700

701701
// nModifiedFees includes any fee deltas from PrioritiseTransaction
702-
nModifiedFees = ws.m_fee_out;
702+
nModifiedFees = ws.m_base_fees;
703703
m_pool.ApplyDelta(hash, nModifiedFees);
704704

705705
// Keep track of transactions that spend a coinbase, which we re-scan
@@ -713,7 +713,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
713713
}
714714
}
715715

716-
entry.reset(new CTxMemPoolEntry(ptx, ws.m_fee_out, nAcceptTime, ::ChainActive().Height(),
716+
entry.reset(new CTxMemPoolEntry(ptx, ws.m_base_fees, nAcceptTime, ::ChainActive().Height(),
717717
fSpendsCoinbase, nSigOpsCost, lp));
718718
unsigned int nSize = entry->GetTxSize();
719719

@@ -920,7 +920,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
920920
bool MemPoolAccept::PolicyScriptChecks(const ATMPArgs& args, Workspace& ws, PrecomputedTransactionData& txdata)
921921
{
922922
const CTransaction& tx = *ws.m_ptx;
923-
TxValidationState &state = ws.m_state;
923+
TxValidationState& state = ws.m_state;
924924

925925
constexpr unsigned int scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS;
926926

@@ -947,7 +947,7 @@ bool MemPoolAccept::ConsensusScriptChecks(const ATMPArgs& args, Workspace& ws, P
947947
{
948948
const CTransaction& tx = *ws.m_ptx;
949949
const uint256& hash = ws.m_hash;
950-
TxValidationState &state = ws.m_state;
950+
TxValidationState& state = ws.m_state;
951951
const CChainParams& chainparams = args.m_chainparams;
952952

953953
// Check again against the current block tip's script verification
@@ -978,7 +978,7 @@ bool MemPoolAccept::Finalize(const ATMPArgs& args, Workspace& ws)
978978
{
979979
const CTransaction& tx = *ws.m_ptx;
980980
const uint256& hash = ws.m_hash;
981-
TxValidationState &state = ws.m_state;
981+
TxValidationState& state = ws.m_state;
982982
const bool bypass_limits = args.m_bypass_limits;
983983

984984
CTxMemPool::setEntries& allConflicting = ws.m_all_conflicting;
@@ -1025,30 +1025,30 @@ MempoolAcceptResult MemPoolAccept::AcceptSingleTransaction(const CTransactionRef
10251025
AssertLockHeld(cs_main);
10261026
LOCK(m_pool.cs); // mempool "read lock" (held through GetMainSignals().TransactionAddedToMempool())
10271027

1028-
Workspace workspace(ptx);
1028+
Workspace ws(ptx);
10291029

1030-
if (!PreChecks(args, workspace)) return MempoolAcceptResult(workspace.m_state);
1030+
if (!PreChecks(args, ws)) return MempoolAcceptResult(ws.m_state);
10311031

10321032
// Only compute the precomputed transaction data if we need to verify
10331033
// scripts (ie, other policy checks pass). We perform the inexpensive
10341034
// checks first and avoid hashing and signature verification unless those
10351035
// checks pass, to mitigate CPU exhaustion denial-of-service attacks.
10361036
PrecomputedTransactionData txdata;
10371037

1038-
if (!PolicyScriptChecks(args, workspace, txdata)) return MempoolAcceptResult(workspace.m_state);
1038+
if (!PolicyScriptChecks(args, ws, txdata)) return MempoolAcceptResult(ws.m_state);
10391039

1040-
if (!ConsensusScriptChecks(args, workspace, txdata)) return MempoolAcceptResult(workspace.m_state);
1040+
if (!ConsensusScriptChecks(args, ws, txdata)) return MempoolAcceptResult(ws.m_state);
10411041

10421042
// Tx was accepted, but not added
10431043
if (args.m_test_accept) {
1044-
return MempoolAcceptResult(std::move(workspace.m_replaced_transactions), workspace.m_fee_out);
1044+
return MempoolAcceptResult(std::move(ws.m_replaced_transactions), ws.m_base_fees);
10451045
}
10461046

1047-
if (!Finalize(args, workspace)) return MempoolAcceptResult(workspace.m_state);
1047+
if (!Finalize(args, ws)) return MempoolAcceptResult(ws.m_state);
10481048

10491049
GetMainSignals().TransactionAddedToMempool(ptx, m_pool.GetAndIncrementSequence());
10501050

1051-
return MempoolAcceptResult(std::move(workspace.m_replaced_transactions), workspace.m_fee_out);
1051+
return MempoolAcceptResult(std::move(ws.m_replaced_transactions), ws.m_base_fees);
10521052
}
10531053

10541054
} // anon namespace
@@ -1080,8 +1080,7 @@ static MempoolAcceptResult AcceptToMemoryPoolWithTime(const CChainParams& chainp
10801080

10811081
MempoolAcceptResult AcceptToMemoryPool(CTxMemPool& pool, const CTransactionRef &tx, bool bypass_limits, bool test_accept)
10821082
{
1083-
const CChainParams& chainparams = Params();
1084-
return AcceptToMemoryPoolWithTime(chainparams, pool, tx, GetTime(), bypass_limits, test_accept);
1083+
return AcceptToMemoryPoolWithTime(Params(), pool, tx, GetTime(), bypass_limits, test_accept);
10851084
}
10861085

10871086
CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, const Consensus::Params& consensusParams, uint256& hashBlock)

0 commit comments

Comments
 (0)