Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ before 1.0).

### Fixed

- **`cmpct_differential` extra `getblocktxn`:** agree whenever Core's
indexes are a subset of ours, not only recipe `[1, 4]` vs `[1]`.
Nightly `[0, 251, 229, 55, 51, 13, 10]` is ours `[2, 4]` vs Core `[2]`.
Omitting an index Core requested still panics.

- **Unreachable I2P stays out of addrman:** without `--i2p-sam`, an addrv2
I2P row is relayed and not stored. `getnodeaddresses` `network=i2p` is
empty. Core `p2p_addrv2_relay`.
Expand Down
33 changes: 20 additions & 13 deletions fuzz/src/cmpct_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,11 @@ pub fn prepare_cmpct_fuzz_case(data: &[u8]) -> Option<CmpctFuzzCase> {
Some(structured_cmpct_case(data))
}

/// Core extra-txn may place a duplicate-txid slot we still `getblocktxn`
/// (018). Agree when the sets match, or the documented 018 extra-ours
/// (`[1, 4]` vs Core `[1]`). Omitting a Core index always disagrees.
/// Core extra-txn may fill a duplicate-txid slot we still `getblocktxn`
/// (018). Agree when every Core index is one of ours. Extra ours is that
/// missing ring, not a split. Omitting a Core index disagrees.
pub fn cmpct_getblocktxn_agrees(ours: &[u64], core: &[u64]) -> bool {
if !core.iter().all(|i| ours.contains(i)) {
return false;
}
if ours.iter().all(|i| core.contains(i)) {
return true;
}
ours.len() == 2 && core == [1] && ours.contains(&1) && ours.contains(&4)
core.iter().all(|i| ours.contains(i))
}

/// Missing indexes using the case fill set (empty = mempool-cold).
Expand Down Expand Up @@ -283,12 +277,25 @@ mod tests {
"018 extra missing vs Core extra-txn fill must not panic"
);
assert!(cmpct_getblocktxn_agrees(&[1], &[1]));
assert!(
cmpct_getblocktxn_agrees(&[1, 2], &[1]),
"extra ours is the missing extra-txn ring"
);
assert!(cmpct_getblocktxn_agrees(&[2, 4], &[2]));
assert!(!cmpct_getblocktxn_agrees(&[1], &[1, 4]));
assert!(!cmpct_getblocktxn_agrees(&[], &[1]));
assert!(
!cmpct_getblocktxn_agrees(&[1, 2], &[1]),
"extra ours on a non-018 recipe must disagree"
}

#[test]
fn overnight_fill_dup_requests_2_and_4() {
// fuzz.yml 35728126468: `[0, 251, 229, 55, 51, 13, 10]`
// ours [2, 4], Core getblocktxn [2].
let case = prepare_cmpct_fuzz_case(&[0, 251, 229, 55, 51, 13, 10]).unwrap();
assert_eq!(
cmpct_missing_for_case(&case).as_deref(),
Some(&[2u64, 4][..])
);
assert!(cmpct_getblocktxn_agrees(&[2, 4], &[2]));
}

#[test]
Expand Down
Loading