Skip to content

Commit 7462122

Browse files
chore: clang format
1 parent a28aac0 commit 7462122

File tree

4 files changed

+24
-31
lines changed

4 files changed

+24
-31
lines changed

src/chainlock/chainlock.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -496,55 +496,54 @@ void CChainLocksHandler::Cleanup()
496496

497497
void CChainLocksHandler::QueueCoinbaseChainLock(const chainlock::ChainLockSig& clsig)
498498
{
499-
AssertLockNotHeld(cs);
500499
LOCK(cs);
501-
500+
502501
if (!IsEnabled()) {
503502
return;
504503
}
505-
504+
506505
// Only queue if it's potentially newer than what we have
507506
if (!bestChainLock.IsNull() && clsig.getHeight() <= bestChainLock.getHeight()) {
508507
return;
509508
}
510-
509+
511510
// Check if we've already seen this chainlock
512511
const uint256 hash = ::SerializeHash(clsig);
513512
if (seenChainLocks.count(hash) != 0) {
514513
return;
515514
}
516-
515+
517516
pendingCoinbaseChainLocks.push_back(clsig);
518517
}
519518

520519
void CChainLocksHandler::ProcessPendingCoinbaseChainLocks()
521520
{
522521
AssertLockNotHeld(cs);
523522
AssertLockNotHeld(cs_main);
524-
523+
525524
if (!IsEnabled()) {
526525
return;
527526
}
528-
527+
529528
std::vector<chainlock::ChainLockSig> toProcess;
530529
{
531530
LOCK(cs);
532531
if (pendingCoinbaseChainLocks.empty()) {
533532
return;
534533
}
535-
534+
536535
// Move all pending chainlocks to a local vector for processing
537536
toProcess.reserve(pendingCoinbaseChainLocks.size());
538537
while (!pendingCoinbaseChainLocks.empty()) {
539538
toProcess.push_back(pendingCoinbaseChainLocks.front());
540539
pendingCoinbaseChainLocks.pop_front();
541540
}
542541
}
543-
542+
544543
// Process each chainlock outside the lock
545544
for (const auto& clsig : toProcess) {
546545
const uint256 hash = ::SerializeHash(clsig);
547-
546+
548547
// Check again if we still want to process this (might have been processed via network)
549548
{
550549
LOCK(cs);
@@ -555,7 +554,7 @@ void CChainLocksHandler::ProcessPendingCoinbaseChainLocks()
555554
continue;
556555
}
557556
}
558-
557+
559558
// Process as if it came from a coinbase (from = -1 means internal)
560559
// Ignore return value as we're processing internally from coinbase
561560
(void)ProcessNewChainLock(-1, clsig, hash);

src/chainlock/chainlock.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,12 @@ class CChainLocksHandler final : public chainlock::ChainLockSignerParent
132132

133133
// Queue a coinbase chainlock for asynchronous processing
134134
// This is called during block validation to avoid blocking
135-
void QueueCoinbaseChainLock(const chainlock::ChainLockSig& clsig)
136-
EXCLUSIVE_LOCKS_REQUIRED(!cs);
135+
void QueueCoinbaseChainLock(const chainlock::ChainLockSig& clsig) EXCLUSIVE_LOCKS_REQUIRED(!cs);
137136

138137
private:
139138
void Cleanup()
140139
EXCLUSIVE_LOCKS_REQUIRED(!cs);
141-
void ProcessPendingCoinbaseChainLocks()
142-
EXCLUSIVE_LOCKS_REQUIRED(!cs);
140+
void ProcessPendingCoinbaseChainLocks() EXCLUSIVE_LOCKS_REQUIRED(!cs);
143141
};
144142

145143
bool AreChainLocksEnabled(const CSporkManager& sporkman);

src/evo/specialtxman.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB
651651
const CBlockIndex* pindexCL = pindex->GetAncestor(curBlockCoinbaseCLHeight);
652652
if (pindexCL) {
653653
uint256 curBlockCoinbaseCLBlockHash = pindexCL->GetBlockHash();
654-
chainlock::ChainLockSig clsig(curBlockCoinbaseCLHeight, curBlockCoinbaseCLBlockHash, opt_cbTx->bestCLSignature);
654+
chainlock::ChainLockSig clsig(curBlockCoinbaseCLHeight, curBlockCoinbaseCLBlockHash,
655+
opt_cbTx->bestCLSignature);
655656
m_clhandler.QueueCoinbaseChainLock(clsig);
656657
}
657658
}

src/test/llmq_chainlock_tests.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include <streams.h>
99
#include <util/strencodings.h>
1010

11-
#include <chainlock/clsig.h>
1211
#include <chainlock/chainlock.h>
12+
#include <chainlock/clsig.h>
1313
#include <llmq/context.h>
1414
#include <validation.h>
1515

@@ -174,35 +174,30 @@ BOOST_AUTO_TEST_CASE(coinbase_chainlock_queueing_test)
174174
{
175175
// Test that coinbase chainlocks can be queued for processing
176176
// This test verifies the queueing mechanism works without requiring full block processing
177-
177+
178178
TestingSetup test_setup(CBaseChainParams::REGTEST);
179-
179+
180180
// Create a chainlock handler
181-
llmq::CChainLocksHandler handler(
182-
test_setup.m_node.chainman->ActiveChainstate(),
183-
*test_setup.m_node.llmq_ctx->qman,
184-
*test_setup.m_node.sporkman,
185-
*test_setup.m_node.mempool,
186-
*test_setup.m_node.mn_sync
187-
);
188-
181+
llmq::CChainLocksHandler handler(test_setup.m_node.chainman->ActiveChainstate(), *test_setup.m_node.llmq_ctx->qman,
182+
*test_setup.m_node.sporkman, *test_setup.m_node.mempool, *test_setup.m_node.mn_sync);
183+
189184
// Create a test chainlock
190185
int32_t height = 100;
191186
uint256 blockHash = GetTestBlockHash(100);
192187
ChainLockSig clsig = CreateChainLock(height, blockHash);
193-
188+
194189
// Verify the chainlock is not null
195190
BOOST_CHECK(!clsig.IsNull());
196191
BOOST_CHECK_EQUAL(clsig.getHeight(), height);
197-
192+
198193
// Queue the chainlock (this should not fail even if chainlocks are disabled)
199194
// The handler will check if chainlocks are enabled internally
200195
handler.QueueCoinbaseChainLock(clsig);
201-
196+
202197
// Create a newer chainlock
203198
ChainLockSig clsig2 = CreateChainLock(height + 1, GetTestBlockHash(101));
204199
handler.QueueCoinbaseChainLock(clsig2);
205-
200+
206201
// Queueing should succeed without errors
207202
// Note: Actual processing requires chainlocks to be enabled and the scheduler to run,
208203
// which is tested in functional tests (feature_llmq_chainlocks.py)

0 commit comments

Comments
 (0)