Skip to content
Snippets Groups Projects
Commit dae267df authored by Éloïs's avatar Éloïs
Browse files

[feat] message: add blockchain req: get current blockstamp

parent 3a8a14c6
No related branches found
No related tags found
1 merge request!109Resolve "Fork resolution algorithm"
......@@ -39,6 +39,8 @@ pub enum DursReqContent {
#[derive(Debug, Clone, PartialEq)]
/// Inter-module Blockchain request for blockchain data
pub enum BlockchainRequest {
/// Current blockstamp
CurrentBlockstamp(),
/// Current block
CurrentBlock(),
/// Block by number
......
......@@ -57,6 +57,8 @@ pub struct PendingIdtyDatas {
#[derive(Debug, Clone)]
/// Response to a BlockchainReqBlockchain request
pub enum BlockchainResponse {
/// Current blockstamp
CurrentBlockstamp(ModuleReqId, Blockstamp),
/// Current block
CurrentBlock(ModuleReqId, Box<BlockDocument>, Blockstamp),
/// Block by number
......
......@@ -27,6 +27,12 @@ pub fn receive_req(
) {
if let DursReqContent::BlockchainRequest(ref blockchain_req) = req_content {
match *blockchain_req {
BlockchainRequest::CurrentBlockstamp() => responses::sent::send_req_response(
bc,
req_from,
req_id,
&BlockchainResponse::CurrentBlockstamp(req_id, bc.current_blockstamp),
),
BlockchainRequest::CurrentBlock() => {
debug!("BlockchainModule : receive DALReqBc::CurrentBlock()");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment