Use MAX_BLOCK_REORG_HEIGHT in zebra-checkpoints
MAX_BLOCK_REORG_HEIGHT is 1 less than the constant it replaces. The new calculation is correct: the 100th block is finalized.
This commit is contained in:
parent
90e755472c
commit
672b39a847
|
|
@ -3356,6 +3356,7 @@ dependencies = [
|
||||||
"tracing-subscriber 0.2.14",
|
"tracing-subscriber 0.2.14",
|
||||||
"zebra-chain",
|
"zebra-chain",
|
||||||
"zebra-consensus",
|
"zebra-consensus",
|
||||||
|
"zebra-state",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ use service::QueuedBlock;
|
||||||
use sled_state::FinalizedState;
|
use sled_state::FinalizedState;
|
||||||
|
|
||||||
pub use config::Config;
|
pub use config::Config;
|
||||||
|
pub use constants::MAX_BLOCK_REORG_HEIGHT;
|
||||||
pub use error::{BoxError, CloneError, CommitBlockError, ValidateContextError};
|
pub use error::{BoxError, CloneError, CommitBlockError, ValidateContextError};
|
||||||
pub use request::{HashOrHeight, Request};
|
pub use request::{HashOrHeight, Request};
|
||||||
pub use response::Response;
|
pub use response::Response;
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,4 @@ tracing-subscriber = { version = "0.2.14", features = ["tracing-log"] }
|
||||||
|
|
||||||
zebra-chain = { path = "../zebra-chain" }
|
zebra-chain = { path = "../zebra-chain" }
|
||||||
zebra-consensus = { path = "../zebra-consensus" }
|
zebra-consensus = { path = "../zebra-consensus" }
|
||||||
|
zebra-state = { path = "../zebra-state" }
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,6 @@ mod args;
|
||||||
/// constant factor of the serialized size.
|
/// constant factor of the serialized size.
|
||||||
const MAX_CHECKPOINT_BYTE_COUNT: u64 = 256 * 1024 * 1024;
|
const MAX_CHECKPOINT_BYTE_COUNT: u64 = 256 * 1024 * 1024;
|
||||||
|
|
||||||
/// Checkpoints must be on the main chain, so we skip blocks that are within the
|
|
||||||
/// zcashd reorg limit.
|
|
||||||
const BLOCK_REORG_LIMIT: block::Height = block::Height(100);
|
|
||||||
|
|
||||||
/// Initialise tracing using its defaults.
|
/// Initialise tracing using its defaults.
|
||||||
fn init_tracing() {
|
fn init_tracing() {
|
||||||
tracing_subscriber::Registry::default()
|
tracing_subscriber::Registry::default()
|
||||||
|
|
@ -89,9 +85,11 @@ fn main() -> Result<()> {
|
||||||
// calculate the maximum height
|
// calculate the maximum height
|
||||||
let height_limit: block::Height = cmd_output(&mut cmd)?.trim().parse()?;
|
let height_limit: block::Height = cmd_output(&mut cmd)?.trim().parse()?;
|
||||||
assert!(height_limit <= block::Height::MAX);
|
assert!(height_limit <= block::Height::MAX);
|
||||||
|
// Checkpoints must be on the main chain, so we skip blocks that are within the
|
||||||
|
// Zcash reorg limit.
|
||||||
let height_limit = height_limit
|
let height_limit = height_limit
|
||||||
.0
|
.0
|
||||||
.checked_sub(BLOCK_REORG_LIMIT.0)
|
.checked_sub(zebra_state::MAX_BLOCK_REORG_HEIGHT.0)
|
||||||
.map(block::Height)
|
.map(block::Height)
|
||||||
.expect("zcashd has some mature blocks: wait for zcashd to sync more blocks");
|
.expect("zcashd has some mature blocks: wait for zcashd to sync more blocks");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue