@@ -181,22 +181,6 @@ static const int64_t ADDRMAN_TEST_WINDOW = 40*60; // 40 minutes
181
181
class CAddrMan
182
182
{
183
183
public:
184
- // Compressed IP->ASN mapping, loaded from a file when a node starts.
185
- // Should be always empty if no file was provided.
186
- // This mapping is then used for bucketing nodes in Addrman.
187
- //
188
- // If asmap is provided, nodes will be bucketed by
189
- // AS they belong to, in order to make impossible for a node
190
- // to connect to several nodes hosted in a single AS.
191
- // This is done in response to Erebus attack, but also to generally
192
- // diversify the connections every node creates,
193
- // especially useful when a large fraction of nodes
194
- // operate under a couple of cloud providers.
195
- //
196
- // If a new asmap was provided, the existing records
197
- // would be re-bucketed accordingly.
198
- const std::vector<bool > m_asmap;
199
-
200
184
// Read asmap from provided binary file
201
185
static std::vector<bool > DecodeAsmap (fs::path path);
202
186
@@ -593,6 +577,8 @@ class CAddrMan
593
577
Check ();
594
578
}
595
579
580
+ const std::vector<bool >& GetAsmap () const { return m_asmap; }
581
+
596
582
private:
597
583
// ! A mutex to protect the inner data structures.
598
584
mutable Mutex cs;
@@ -660,6 +646,22 @@ class CAddrMan
660
646
/* * Perform consistency checks every m_consistency_check_ratio operations (if non-zero). */
661
647
const int32_t m_consistency_check_ratio;
662
648
649
+ // Compressed IP->ASN mapping, loaded from a file when a node starts.
650
+ // Should be always empty if no file was provided.
651
+ // This mapping is then used for bucketing nodes in Addrman.
652
+ //
653
+ // If asmap is provided, nodes will be bucketed by
654
+ // AS they belong to, in order to make impossible for a node
655
+ // to connect to several nodes hosted in a single AS.
656
+ // This is done in response to Erebus attack, but also to generally
657
+ // diversify the connections every node creates,
658
+ // especially useful when a large fraction of nodes
659
+ // operate under a couple of cloud providers.
660
+ //
661
+ // If a new asmap was provided, the existing records
662
+ // would be re-bucketed accordingly.
663
+ const std::vector<bool > m_asmap;
664
+
663
665
// ! Find an entry.
664
666
CAddrInfo* Find (const CNetAddr& addr, int *pnId = nullptr ) EXCLUSIVE_LOCKS_REQUIRED(cs);
665
667
0 commit comments