diff --git a/massa-grpc/src/api.rs b/massa-grpc/src/api.rs index 1447b5638d6..a578176ee5b 100644 --- a/massa-grpc/src/api.rs +++ b/massa-grpc/src/api.rs @@ -7,6 +7,7 @@ use massa_consensus_exports::{ConsensusChannels, ConsensusController}; use massa_models::{ block::{BlockDeserializer, BlockDeserializerArgs, SecureShareBlock}, config::{ENDORSEMENT_COUNT, MAX_OPERATIONS_PER_BLOCK, THREAD_COUNT}, + error::ModelsError, secure_share::SecureShareDeserializer, }; use massa_pool_exports::PoolChannels; @@ -193,9 +194,23 @@ impl grpc::grpc_server::Grpc for MassaService { Ok(tuple) => { let (rest, res_block): (&[u8], SecureShareBlock) = tuple; if rest.is_empty() { - if let Ok(_verify_signature) = - //TODO add endorsements signatures check - res_block.verify_signature() + if let Ok(_verify_signature) = res_block + .verify_signature() + .and_then(|_| { + res_block.content.header.verify_signature() + }) + .map(|_| { + res_block + .content + .header + .content + .endorsements + .iter() + .map(|endorsement| { + endorsement.verify_signature() + }) + .collect::>>() + }) { let block_id = res_block.id; let slot = res_block.content.header.content.slot; @@ -255,12 +270,11 @@ impl grpc::grpc_server::Grpc for MassaService { .await; }; } else { - let error = "incomplete deserialization"; let _res = sendblocks_notify_error( req_content.id.clone(), tx.clone(), tonic::Code::InvalidArgument, - error.to_owned(), + "incomplete deserialization".to_owned(), ) .await; }