assert 2 items in stores don't have same slot and version with different values (#15250)

* assert 2 items in stores don't have same slot and version with different values

* add message to assert
This commit is contained in:
Jeff Washington (jwash) 2021-02-16 12:12:59 -06:00 committed by GitHub
parent 17a328bc6f
commit 708b8380b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -4097,6 +4097,14 @@ impl AccountsDB {
i = k; i = k;
look_for_first_key = false; look_for_first_key = false;
continue 'outer; continue 'outer;
} else {
let prev = &slice[k - 1];
assert!(
!(prev.slot == now.slot
&& prev.version == now.version
&& (prev.hash != now.hash || prev.lamports != now.lamports)),
"Conflicting store data. Pubkey: {}, Slot: {}, Version: {}, Hashes: {}, {}, Lamports: {}, {}", now.pubkey, now.slot, now.version, prev.hash, now.hash, prev.lamports, now.lamports
);
} }
} }
@ -5938,7 +5946,13 @@ pub mod tests {
.zip(keys.iter()) .zip(keys.iter())
.enumerate() .enumerate()
.map(|(i, (hash, key))| { .map(|(i, (hash, key))| {
CalculateHashIntermediate::new(VERSION, hash, (i + 1) as u64, Slot::default(), *key) CalculateHashIntermediate::new(
VERSION,
hash,
(i + 1) as u64,
u64::MAX - i as u64,
*key,
)
}) })
.collect(); .collect();