@@ -153,34 +153,28 @@ MessageProcessingResult CChainLocksHandler::ProcessNewChainLock(const NodeId fro
153153 }
154154
155155 const CBlockIndex* pindex = WITH_LOCK (::cs_main, return m_chainstate.m_blockman .LookupBlockIndex (clsig.getBlockHash ()));
156+ const CInv clsig_inv (MSG_CLSIG, hash);
156157
157158 {
158159 LOCK (cs);
159160 bestChainLockHash = hash;
160161 bestChainLock = clsig;
161162
162- if (pindex != nullptr ) {
163+ if (pindex) {
163164 if (pindex->nHeight != clsig.getHeight ()) {
164165 // Should not happen, same as the conflict check from above.
165166 LogPrintf (" CChainLocksHandler::%s -- height of CLSIG (%s) does not match the specified block's height (%d)\n " ,
166167 __func__, clsig.ToString (), pindex->nHeight );
167168 // Note: not relaying clsig here
168169 return {};
169170 }
170-
171171 bestChainLockWithKnownBlock = bestChainLock;
172172 bestChainLockBlockIndex = pindex;
173+ } else {
174+ // We don't know the block/header for this CLSIG yet, so bail out for now and when the
175+ // block/header later comes in, we will enforce the correct chain. We still relay further.
176+ return clsig_inv;
173177 }
174- // else if (pindex == nullptr)
175- // Note: make sure to still relay clsig further.
176- }
177-
178- CInv clsigInv (MSG_CLSIG, hash);
179-
180- if (pindex == nullptr ) {
181- // we don't know the block/header for this CLSIG yet, so bail out for now
182- // when the block or the header later comes in, we will enforce the correct chain
183- return clsigInv;
184178 }
185179
186180 scheduler->scheduleFromNow (
@@ -192,7 +186,8 @@ MessageProcessingResult CChainLocksHandler::ProcessNewChainLock(const NodeId fro
192186
193187 LogPrint (BCLog::CHAINLOCKS, " CChainLocksHandler::%s -- processed new CLSIG (%s), peer=%d\n " , __func__,
194188 clsig.ToString (), from);
195- return clsigInv;
189+
190+ return clsig_inv;
196191}
197192
198193void CChainLocksHandler::AcceptedBlockHeader (gsl::not_null<const CBlockIndex*> pindexNew)
0 commit comments