@@ -504,14 +504,14 @@ friend class CAddrManTest;
504
504
// so we store all bucket-entry_index pairs to iterate through later.
505
505
std::vector<std::pair<int , int >> bucket_entries;
506
506
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 );
515
515
}
516
516
}
517
517
}
@@ -527,13 +527,13 @@ friend class CAddrManTest;
527
527
528
528
for (auto bucket_entry : bucket_entries) {
529
529
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 ];
532
532
int nUBucketPos = info.GetBucketPosition (nKey, true , bucket);
533
533
if (format >= Format::V2_ASMAP && nUBuckets == ADDRMAN_NEW_BUCKET_COUNT && vvNew[bucket][nUBucketPos] == -1 &&
534
534
info.nRefCount < ADDRMAN_NEW_BUCKETS_PER_ADDRESS && serialized_asmap_version == supplied_asmap_version) {
535
535
// Bucketing has not changed, using existing bucket positions for the new table
536
- vvNew[bucket][nUBucketPos] = n ;
536
+ vvNew[bucket][nUBucketPos] = entry_index ;
537
537
info.nRefCount ++;
538
538
} else {
539
539
// In case the new table data cannot be used (format unknown, bucket count wrong or new asmap),
@@ -542,7 +542,7 @@ friend class CAddrManTest;
542
542
bucket = info.GetNewBucket (nKey, m_asmap);
543
543
nUBucketPos = info.GetBucketPosition (nKey, true , bucket);
544
544
if (vvNew[bucket][nUBucketPos] == -1 ) {
545
- vvNew[bucket][nUBucketPos] = n ;
545
+ vvNew[bucket][nUBucketPos] = entry_index ;
546
546
info.nRefCount ++;
547
547
}
548
548
}
0 commit comments