Skip to content

Commit

Permalink
increment the nonce while the difficulty is invalid instead of while …
Browse files Browse the repository at this point in the history
…the difficulty threshold is invalid
  • Loading branch information
arya2 committed May 14, 2024
1 parent a7ed273 commit 2703ec0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion zebra-consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub mod router;
pub mod transaction;

#[cfg(any(test, feature = "proptest-impl"))]
pub use block::check::difficulty_threshold_is_valid;
pub use block::check::difficulty_is_valid;

pub use block::{
subsidy::{
Expand Down
10 changes: 3 additions & 7 deletions zebrad/tests/common/regtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,9 @@ async fn submit_blocks(network: Network, rpc_address: SocketAddr) -> Result<()>
.coinbase_height()
.expect("should have a coinbase height");

while zebra_consensus::difficulty_threshold_is_valid(
&block.header,
&network,
&height,
&block.hash(),
)
.is_err()
while !network.disable_pow()
&& zebra_consensus::difficulty_is_valid(&block.header, &network, &height, &block.hash())
.is_err()
{
increment_big_endian(Arc::make_mut(&mut block.header).nonce.as_mut());
}
Expand Down

0 comments on commit 2703ec0

Please sign in to comment.