Test-only struct, capturing info about an address in AddrMan */
| 30 | |
| 31 | /** Test-only struct, capturing info about an address in AddrMan */ |
| 32 | struct AddressPosition { |
| 33 | // Whether the address is in the new or tried table |
| 34 | const bool tried; |
| 35 | |
| 36 | // Addresses in the tried table should always have a multiplicity of 1. |
| 37 | // Addresses in the new table can have multiplicity between 1 and |
| 38 | // ADDRMAN_NEW_BUCKETS_PER_ADDRESS |
| 39 | const int multiplicity; |
| 40 | |
| 41 | // If the address is in the new table, the bucket and position are |
| 42 | // populated based on the first source who sent the address. |
| 43 | // In certain edge cases, this may not be where the address is currently |
| 44 | // located. |
| 45 | const int bucket; |
| 46 | const int position; |
| 47 | |
| 48 | bool operator==(AddressPosition other) { |
| 49 | return std::tie(tried, multiplicity, bucket, position) == |
| 50 | std::tie(other.tried, other.multiplicity, other.bucket, other.position); |
| 51 | } |
| 52 | explicit AddressPosition(bool tried_in, int multiplicity_in, int bucket_in, int position_in) |
| 53 | : tried{tried_in}, multiplicity{multiplicity_in}, bucket{bucket_in}, position{position_in} {} |
| 54 | }; |
| 55 | |
| 56 | /** Stochastic address manager |
| 57 | * |