Tweak some assertions to better match their error messages (#2822)

* Change assertion condition to match message

Refactor the condition so that the expression is easier to compare to
the panic message.

* Change comparison order to match panic message

Change the order of the equality so that it matches the panic message.
This commit is contained in:
Janito Vaqueiro Ferreira Filho 2021-10-04 10:31:56 -03:00 committed by GitHub
parent 21a3e434bc
commit 800141446c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -200,7 +200,7 @@ impl NonEmptyHistoryTree {
.expect("block must have coinbase height during contextual verification");
assert!(
height - self.current_height == 1,
Some(height) == self.current_height + 1,
"added block with height {:?} but it must be {:?}+1",
height,
self.current_height

View File

@ -184,7 +184,7 @@ impl<V: Version> Tree<V> {
let network_upgrade = NetworkUpgrade::current(self.network, height);
assert!(
self.network_upgrade == network_upgrade,
network_upgrade == self.network_upgrade,
"added block from network upgrade {:?} but history tree is restricted to {:?}",
network_upgrade,
self.network_upgrade