Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14865014
D11641.id34093.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D11641.id34093.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Wed, May 21, 00:23 (1 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865858
Default Alt Text
D11641.id34093.diff (2 KB)
Attached To
D11641: [avalanche] Make IsWorthPolling a private method of the processor
Event Timeline
Log In to Comment