Skip to content

Commit ac3547e

Browse files
committed
[addrman] Improve variable naming/code style of touched code.
1 parent a5c9b04 commit ac3547e

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/addrman.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,9 @@ friend class CAddrManTest;
517517
}
518518
}
519519

520-
// Attempt to restore the entry's new buckets if the bucket count and asmap
521-
// checksum haven't changed
520+
// If the bucket count and asmap checksum haven't changed, then attempt
521+
// to restore the entries to the buckets/positions they were in before
522+
// serialization.
522523
uint256 supplied_asmap_checksum;
523524
if (m_asmap.size() != 0) {
524525
supplied_asmap_checksum = SerializeHash(m_asmap);
@@ -540,20 +541,20 @@ friend class CAddrManTest;
540541
// this bucket_entry.
541542
if (info.nRefCount >= ADDRMAN_NEW_BUCKETS_PER_ADDRESS) continue;
542543

543-
int nUBucketPos = info.GetBucketPosition(nKey, true, bucket);
544-
if (restore_bucketing && vvNew[bucket][nUBucketPos] == -1) {
544+
int bucket_position = info.GetBucketPosition(nKey, true, bucket);
545+
if (restore_bucketing && vvNew[bucket][bucket_position] == -1) {
545546
// Bucketing has not changed, using existing bucket positions for the new table
546-
vvNew[bucket][nUBucketPos] = entry_index;
547-
info.nRefCount++;
547+
vvNew[bucket][bucket_position] = entry_index;
548+
++info.nRefCount;
548549
} else {
549550
// In case the new table data cannot be used (bucket count wrong or new asmap),
550551
// try to give them a reference based on their primary source address.
551552
LogPrint(BCLog::ADDRMAN, "Bucketing method was updated, re-bucketing addrman entries from disk\n");
552553
bucket = info.GetNewBucket(nKey, m_asmap);
553-
nUBucketPos = info.GetBucketPosition(nKey, true, bucket);
554-
if (vvNew[bucket][nUBucketPos] == -1) {
555-
vvNew[bucket][nUBucketPos] = entry_index;
556-
info.nRefCount++;
554+
bucket_position = info.GetBucketPosition(nKey, true, bucket);
555+
if (vvNew[bucket][bucket_position] == -1) {
556+
vvNew[bucket][bucket_position] = entry_index;
557+
++info.nRefCount;
557558
}
558559
}
559560
}

0 commit comments

Comments
 (0)