Skip to content

Commit 009b8e0

Browse files
committed
[addrman] Improve variable naming/code style of touched code.
1 parent b4c5fda commit 009b8e0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/addrman.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -504,14 +504,14 @@ friend class CAddrManTest;
504504
// so we store all bucket-entry_index pairs to iterate through later.
505505
std::vector<std::pair<int, int>> bucket_entries;
506506

507-
for (int bucket = 0; bucket < nUBuckets; bucket++) {
508-
int nSize = 0;
509-
s >> nSize;
510-
for (int n = 0; n < nSize; n++) {
511-
int nIndex = 0;
512-
s >> nIndex;
513-
if (nIndex >= 0 && nIndex < nNew) {
514-
bucket_entries.emplace_back(bucket, nIndex);
507+
for (int bucket = 0; bucket < nUBuckets; ++bucket) {
508+
int num_entries{0};
509+
s >> num_entries;
510+
for (int n = 0; n < num_entries; ++n) {
511+
int entry_index{0};
512+
s >> entry_index;
513+
if (entry_index >= 0 && entry_index < nNew) {
514+
bucket_entries.emplace_back(bucket, entry_index);
515515
}
516516
}
517517
}
@@ -527,13 +527,13 @@ friend class CAddrManTest;
527527

528528
for (auto bucket_entry : bucket_entries) {
529529
int bucket{bucket_entry.first};
530-
const int n{bucket_entry.second};
531-
CAddrInfo& info = mapInfo[n];
530+
const int entry_index{bucket_entry.second};
531+
CAddrInfo& info = mapInfo[entry_index];
532532
int nUBucketPos = info.GetBucketPosition(nKey, true, bucket);
533533
if (format >= Format::V2_ASMAP && nUBuckets == ADDRMAN_NEW_BUCKET_COUNT && vvNew[bucket][nUBucketPos] == -1 &&
534534
info.nRefCount < ADDRMAN_NEW_BUCKETS_PER_ADDRESS && serialized_asmap_version == supplied_asmap_version) {
535535
// Bucketing has not changed, using existing bucket positions for the new table
536-
vvNew[bucket][nUBucketPos] = n;
536+
vvNew[bucket][nUBucketPos] = entry_index;
537537
info.nRefCount++;
538538
} else {
539539
// In case the new table data cannot be used (format unknown, bucket count wrong or new asmap),
@@ -542,7 +542,7 @@ friend class CAddrManTest;
542542
bucket = info.GetNewBucket(nKey, m_asmap);
543543
nUBucketPos = info.GetBucketPosition(nKey, true, bucket);
544544
if (vvNew[bucket][nUBucketPos] == -1) {
545-
vvNew[bucket][nUBucketPos] = n;
545+
vvNew[bucket][nUBucketPos] = entry_index;
546546
info.nRefCount++;
547547
}
548548
}

0 commit comments

Comments
 (0)