check_version

Function check_version 

Source
pub fn check_version(tenderdash_version: &str) -> bool
Expand description

Check if ABCI version sent by Tenderdash matches version of linked protobuf data objects.

You should use this function inside Application::info() handler, to ensure that the protocol versions match. Match is determined based on Semantic Versioning rules, as defined for ‘^’ operator.

§Examples

§Using check_version in Application::info handler

use tenderdash_abci::{check_version, Application};
use tenderdash_abci::proto::abci::{RequestInfo, ResponseInfo, ResponseException};

struct AbciApp{}

impl tenderdash_abci::Application for AbciApp {
  fn info(&self, request: RequestInfo) -> Result<ResponseInfo, ResponseException> {
    if !check_version(&request.abci_version) {
      panic!("abci version mismatch");
    }
    Ok(Default::default())
  }
}