@@ -517,8 +517,9 @@ friend class CAddrManTest;
517
517
}
518
518
}
519
519
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.
522
523
uint256 supplied_asmap_checksum;
523
524
if (m_asmap.size () != 0 ) {
524
525
supplied_asmap_checksum = SerializeHash (m_asmap);
@@ -540,20 +541,20 @@ friend class CAddrManTest;
540
541
// this bucket_entry.
541
542
if (info.nRefCount >= ADDRMAN_NEW_BUCKETS_PER_ADDRESS) continue ;
542
543
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 ) {
545
546
// 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 ;
548
549
} else {
549
550
// In case the new table data cannot be used (bucket count wrong or new asmap),
550
551
// try to give them a reference based on their primary source address.
551
552
LogPrint (BCLog::ADDRMAN, " Bucketing method was updated, re-bucketing addrman entries from disk\n " );
552
553
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 ;
557
558
}
558
559
}
559
560
}
0 commit comments