[addrman] Improve variable naming/code style of touched code.

This commit is contained in:
John Newbery 2020-12-03 11:31:08 +00:00
parent a5c9b04959
commit ac3547eddd

View file

@ -517,8 +517,9 @@ public:
} }
} }
// Attempt to restore the entry's new buckets if the bucket count and asmap // If the bucket count and asmap checksum haven't changed, then attempt
// checksum haven't changed // to restore the entries to the buckets/positions they were in before
// serialization.
uint256 supplied_asmap_checksum; uint256 supplied_asmap_checksum;
if (m_asmap.size() != 0) { if (m_asmap.size() != 0) {
supplied_asmap_checksum = SerializeHash(m_asmap); supplied_asmap_checksum = SerializeHash(m_asmap);
@ -540,20 +541,20 @@ public:
// this bucket_entry. // this bucket_entry.
if (info.nRefCount >= ADDRMAN_NEW_BUCKETS_PER_ADDRESS) continue; if (info.nRefCount >= ADDRMAN_NEW_BUCKETS_PER_ADDRESS) continue;
int nUBucketPos = info.GetBucketPosition(nKey, true, bucket); int bucket_position = info.GetBucketPosition(nKey, true, bucket);
if (restore_bucketing && vvNew[bucket][nUBucketPos] == -1) { if (restore_bucketing && vvNew[bucket][bucket_position] == -1) {
// Bucketing has not changed, using existing bucket positions for the new table // Bucketing has not changed, using existing bucket positions for the new table
vvNew[bucket][nUBucketPos] = entry_index; vvNew[bucket][bucket_position] = entry_index;
info.nRefCount++; ++info.nRefCount;
} else { } else {
// In case the new table data cannot be used (bucket count wrong or new asmap), // In case the new table data cannot be used (bucket count wrong or new asmap),
// try to give them a reference based on their primary source address. // try to give them a reference based on their primary source address.
LogPrint(BCLog::ADDRMAN, "Bucketing method was updated, re-bucketing addrman entries from disk\n"); LogPrint(BCLog::ADDRMAN, "Bucketing method was updated, re-bucketing addrman entries from disk\n");
bucket = info.GetNewBucket(nKey, m_asmap); bucket = info.GetNewBucket(nKey, m_asmap);
nUBucketPos = info.GetBucketPosition(nKey, true, bucket); bucket_position = info.GetBucketPosition(nKey, true, bucket);
if (vvNew[bucket][nUBucketPos] == -1) { if (vvNew[bucket][bucket_position] == -1) {
vvNew[bucket][nUBucketPos] = entry_index; vvNew[bucket][bucket_position] = entry_index;
info.nRefCount++; ++info.nRefCount;
} }
} }
} }