Skip to content

Commit

Permalink
- Fixed an issue with the chain metadata service where it was not upd…
Browse files Browse the repository at this point in the history
…ating its copy of the chain metadata on reorg events. This could have resulted in some nodes on the network reporting outdated chain metadata.

- The chain metadata service will look for both block add and reorg events to determine if the blockchain db state was updated and the latest chain metadata needs to be retrieved.
 -Also, chained the max send retries used by the Message protocol to 1.
  • Loading branch information
Yuko Roodt committed May 19, 2020
1 parent 824dfe0 commit 504d087
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use super::{error::ChainMetadataSyncError, LOG_TARGET};
use crate::{
base_node::{
chain_metadata_service::handle::{ChainMetadataEvent, PeerChainMetadata},
comms_interface::{BlockEvent, Broadcast, LocalNodeCommsInterface},
comms_interface::{BlockEvent, LocalNodeCommsInterface},
proto,
},
chain_storage::BlockAddResult,
Expand Down Expand Up @@ -109,9 +109,8 @@ impl ChainMetadataService {

/// Handle BlockEvents
async fn handle_block_event(&mut self, event: &BlockEvent) -> Result<(), ChainMetadataSyncError> {
let _broadcast = Broadcast::from(true);
match event {
BlockEvent::Verified((_, BlockAddResult::Ok, _broadcast)) => {
BlockEvent::Verified((_, BlockAddResult::Ok, _)) | BlockEvent::Verified((_, BlockAddResult::ChainReorg(_), _)) => {
self.update_liveness_chain_metadata().await?;
},
BlockEvent::Verified(_) | BlockEvent::Invalid(_) => {},
Expand Down
2 changes: 1 addition & 1 deletion comms/src/builder/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ pub const MESSAGING_EVENTS_BUFFER_SIZE: usize = 100;
pub const MESSAGING_REQUEST_BUFFER_SIZE: usize = 50;
/// The default maximum number of times to retry sending a failed message before publishing a SendMessageFailed event.
/// This can be low because dialing a peer is already attempted a number of times.
pub const MESSAGING_MAX_SEND_RETRIES: usize = 2;
pub const MESSAGING_MAX_SEND_RETRIES: usize = 1;

0 comments on commit 504d087

Please sign in to comment.