aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-12-03 11:31:08 +0000
committerJohn Newbery <john@johnnewbery.com>2021-01-18 13:23:16 +0000
commit009b8e0fdf3bfb11668edacced5d8b70726d5d0e (patch)
treed2c80f7f99c2df7c4d347e1a916ac722e59eeddd /src/addrman.h
parentb4c5fda417dd9ff8bf9fe24a87d384a649e3730d (diff)
downloadbitcoin-009b8e0fdf3bfb11668edacced5d8b70726d5d0e.tar.xz
[addrman] Improve variable naming/code style of touched code.
Diffstat (limited to 'src/addrman.h')
-rw-r--r--src/addrman.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/addrman.h b/src/addrman.h
index bcf36d9b3f..4cd4106ff4 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -504,14 +504,14 @@ public:
// so we store all bucket-entry_index pairs to iterate through later.
std::vector<std::pair<int, int>> bucket_entries;
- for (int bucket = 0; bucket < nUBuckets; bucket++) {
- int nSize = 0;
- s >> nSize;
- for (int n = 0; n < nSize; n++) {
- int nIndex = 0;
- s >> nIndex;
- if (nIndex >= 0 && nIndex < nNew) {
- bucket_entries.emplace_back(bucket, nIndex);
+ for (int bucket = 0; bucket < nUBuckets; ++bucket) {
+ int num_entries{0};
+ s >> num_entries;
+ for (int n = 0; n < num_entries; ++n) {
+ int entry_index{0};
+ s >> entry_index;
+ if (entry_index >= 0 && entry_index < nNew) {
+ bucket_entries.emplace_back(bucket, entry_index);
}
}
}
@@ -527,13 +527,13 @@ public:
for (auto bucket_entry : bucket_entries) {
int bucket{bucket_entry.first};
- const int n{bucket_entry.second};
- CAddrInfo& info = mapInfo[n];
+ const int entry_index{bucket_entry.second};
+ CAddrInfo& info = mapInfo[entry_index];
int nUBucketPos = info.GetBucketPosition(nKey, true, bucket);
if (format >= Format::V2_ASMAP && nUBuckets == ADDRMAN_NEW_BUCKET_COUNT && vvNew[bucket][nUBucketPos] == -1 &&
info.nRefCount < ADDRMAN_NEW_BUCKETS_PER_ADDRESS && serialized_asmap_version == supplied_asmap_version) {
// Bucketing has not changed, using existing bucket positions for the new table
- vvNew[bucket][nUBucketPos] = n;
+ vvNew[bucket][nUBucketPos] = entry_index;
info.nRefCount++;
} else {
// In case the new table data cannot be used (format unknown, bucket count wrong or new asmap),
@@ -542,7 +542,7 @@ public:
bucket = info.GetNewBucket(nKey, m_asmap);
nUBucketPos = info.GetBucketPosition(nKey, true, bucket);
if (vvNew[bucket][nUBucketPos] == -1) {
- vvNew[bucket][nUBucketPos] = n;
+ vvNew[bucket][nUBucketPos] = entry_index;
info.nRefCount++;
}
}