Page MenuHomePhabricator

D11641.id.diff
No OneTemporary

D11641.id.diff

diff --git a/src/avalanche/processor.h b/src/avalanche/processor.h
--- a/src/avalanche/processor.h
+++ b/src/avalanche/processor.h
@@ -253,6 +253,9 @@
*/
uint256 buildLocalSighash(CNode *pfrom) const;
+ bool isWorthPolling(const CBlockIndex *pindex) const
+ EXCLUSIVE_LOCKS_REQUIRED(cs_main);
+
friend struct ::avalanche::AvalancheTest;
};
diff --git a/src/avalanche/processor.cpp b/src/avalanche/processor.cpp
--- a/src/avalanche/processor.cpp
+++ b/src/avalanche/processor.cpp
@@ -35,23 +35,6 @@
std::unique_ptr<avalanche::Processor> g_avalanche;
namespace avalanche {
-static bool IsWorthPolling(const CBlockIndex *pindex)
- EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
- AssertLockHeld(cs_main);
-
- if (pindex->nStatus.isInvalid()) {
- // No point polling invalid blocks.
- return false;
- }
-
- if (::ChainstateActive().IsBlockFinalized(pindex)) {
- // There is no point polling finalized block.
- return false;
- }
-
- return true;
-}
-
static bool VerifyProof(const Proof &proof, bilingual_str &error) {
ProofValidationState proof_state;
@@ -334,13 +317,13 @@
bool isAccepted;
if (!pindex) {
- // IsWorthPolling expects this to be non-null, so bail early.
+ // isWorthPolling expects this to be non-null, so bail early.
return false;
}
{
LOCK(cs_main);
- if (!IsWorthPolling(pindex)) {
+ if (!isWorthPolling(pindex)) {
// There is no point polling this block.
return false;
}
@@ -516,7 +499,7 @@
continue;
}
- if (!IsWorthPolling(pindex)) {
+ if (!isWorthPolling(pindex)) {
// There is no point polling this block.
continue;
}
@@ -878,7 +861,7 @@
auto w = blockVoteRecords.getWriteView();
for (auto it = w->begin(); it != w->end();) {
const CBlockIndex *pindex = it->first;
- if (!IsWorthPolling(pindex)) {
+ if (!isWorthPolling(pindex)) {
w->erase(it++);
} else {
++it;
@@ -909,4 +892,20 @@
return hasher.GetHash();
}
+bool Processor::isWorthPolling(const CBlockIndex *pindex) const {
+ AssertLockHeld(cs_main);
+
+ if (pindex->nStatus.isInvalid()) {
+ // No point polling invalid blocks.
+ return false;
+ }
+
+ if (::ChainstateActive().IsBlockFinalized(pindex)) {
+ // There is no point polling finalized block.
+ return false;
+ }
+
+ return true;
+}
+
} // namespace avalanche

File Metadata

Mime Type
text/plain
Expires
Tue, May 20, 23:47 (27 m, 16 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865858
Default Alt Text
D11641.id.diff (2 KB)

Event Timeline