diff --git a/block-production/Cargo.toml b/block-production/Cargo.toml index 9d2f4ee17b..cc57320741 100644 --- a/block-production/Cargo.toml +++ b/block-production/Cargo.toml @@ -41,7 +41,7 @@ rand = "0.8" [dev-dependencies] nimiq-test-log = { path = "../test-log" } # This adds a circular dev-dependency which is fine but breaks VS code rust-analyzer. -# See https://github.com/rust-analyzer/rust-analyzer/issues/2414 +# See https://github.com/rust-analyzer/rust-analyzer/issues/14167 nimiq-genesis-builder = { path = "../genesis-builder" } nimiq-test-utils = { path = "../test-utils" } nimiq-trie = { path = "../primitives/trie" } diff --git a/blockchain/Cargo.toml b/blockchain/Cargo.toml index 4f4db46b62..45e1cf01a8 100644 --- a/blockchain/Cargo.toml +++ b/blockchain/Cargo.toml @@ -48,7 +48,7 @@ nimiq-block-production = { path = "../block-production", features = ["test-utils nimiq-test-log = { path = "../test-log" } nimiq-transaction-builder = { path = "../transaction-builder" } # This adds a circular dev-dependency which is fine but breaks VS code rust-analyzer. -# See https://github.com/rust-analyzer/rust-analyzer/issues/2414 +# See https://github.com/rust-analyzer/rust-analyzer/issues/14167 nimiq-test-utils = { path = "../test-utils" } nimiq-zkp-primitives = { path = "../zkp-primitives" } diff --git a/consensus/Cargo.toml b/consensus/Cargo.toml index 23552e5c07..60129aca19 100644 --- a/consensus/Cargo.toml +++ b/consensus/Cargo.toml @@ -64,7 +64,7 @@ nimiq-network-mock = { path = "../network-mock" } nimiq-network-libp2p = { path = "../network-libp2p" } nimiq-test-log = { path = "../test-log" } # This adds a circular dev-dependency which is fine but breaks VS code rust-analyzer. -# See https://github.com/rust-analyzer/rust-analyzer/issues/2414 +# See https://github.com/rust-analyzer/rust-analyzer/issues/14167 nimiq-test-utils = { path = "../test-utils" } nimiq-zkp-component = { path = "../zkp-component", features = ["zkp-prover", "parallel"] } diff --git a/validator/Cargo.toml b/validator/Cargo.toml index d710b5ac30..f9fa1e060e 100644 --- a/validator/Cargo.toml +++ b/validator/Cargo.toml @@ -63,7 +63,7 @@ nimiq-network-libp2p = { path = "../network-libp2p" } nimiq-network-mock = { path = "../network-mock" } nimiq-test-log = { path = "../test-log" } # This adds a circular dev-dependency which is fine but breaks VS code rust-analyzer. -# See https://github.com/rust-analyzer/rust-analyzer/issues/2414 +# See https://github.com/rust-analyzer/rust-analyzer/issues/14167 nimiq-test-utils = { path = "../test-utils" } [features] diff --git a/validator/src/tendermint.rs b/validator/src/tendermint.rs index cde998d2e9..0f97083097 100644 --- a/validator/src/tendermint.rs +++ b/validator/src/tendermint.rs @@ -407,15 +407,17 @@ where debug!(%error, "Tendermint - await_proposal: Invalid block header, VRF seed verification failed"); Err(ProposalError::InvalidProposal) } else { - // Get a write transaction to the database. - let mut txn = blockchain.write_transaction(); - // Get the blockchain state. let state = blockchain.state(); + // Get a write transaction to the database, even if we don't intend to actually write + // anything out. + let mut txn = blockchain.write_transaction(); + // Update our blockchain state using the received proposal. If we can't update the state, we // return a proposal timeout. if blockchain.commit_accounts(state, &block, &mut txn).is_err() { + txn.abort(); debug!("Tendermint - await_proposal: Can't update state"); return Err(ProposalError::InvalidProposal); } @@ -423,7 +425,9 @@ where // Check the validity of the block against our state. If it is invalid, we return a proposal // timeout. This also returns the block body that matches the block header // (assuming that the block is valid). - match blockchain.verify_block_state(state, &block, Some(&txn)) { + let verification_result = blockchain.verify_block_state(state, &block, Some(&txn)); + txn.abort(); + match verification_result { Ok(Some(inherent)) => Ok(Body(inherent)), Ok(None) => Ok(precalculated_inherent.unwrap()), Err(error) => { diff --git a/zkp-component/Cargo.toml b/zkp-component/Cargo.toml index b73b95c7b9..e379064833 100644 --- a/zkp-component/Cargo.toml +++ b/zkp-component/Cargo.toml @@ -73,7 +73,7 @@ nimiq-network-mock = { path = "../network-mock" } nimiq-network-libp2p = { path = "../network-libp2p" } nimiq-test-log = { path = "../test-log" } # This adds a circular dev-dependency which is fine but breaks VS code rust-analyzer. -# See https://github.com/rust-analyzer/rust-analyzer/issues/2414 +# See https://github.com/rust-analyzer/rust-analyzer/issues/14167 nimiq-test-utils = { path = "../test-utils" } [features]