From 48429ed5ee843848de2d315c3d2fc4b45bb67b18 Mon Sep 17 00:00:00 2001 From: SW van Heerden Date: Fri, 26 Jan 2024 12:15:35 +0200 Subject: [PATCH] more fixes --- .../minotari_app_grpc/proto/base_node.proto | 1 + .../src/grpc/base_node_grpc_server.rs | 24 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/applications/minotari_app_grpc/proto/base_node.proto b/applications/minotari_app_grpc/proto/base_node.proto index 5febcff425..eda1acf63f 100644 --- a/applications/minotari_app_grpc/proto/base_node.proto +++ b/applications/minotari_app_grpc/proto/base_node.proto @@ -360,6 +360,7 @@ message GetNewBlockBlobResult{ bytes block_body = 3; bytes merge_mining_hash =4; bytes utxo_mr = 5; + bytes tari_unique_id =6; } // This is mining data for the miner asking for a new block diff --git a/applications/minotari_node/src/grpc/base_node_grpc_server.rs b/applications/minotari_node/src/grpc/base_node_grpc_server.rs index 5fbda7919e..c6eebed83d 100644 --- a/applications/minotari_node/src/grpc/base_node_grpc_server.rs +++ b/applications/minotari_node/src/grpc/base_node_grpc_server.rs @@ -638,16 +638,16 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer { let gen_hash = handler .get_header(0) .await - .map_err(|s| { + .map_err(|_| { obscure_error_if_true( report_error_flag, - Status::invalid_argument(format!("Malformed block template provided: {}", s)), + Status::invalid_argument("Tari genesis block not found".to_string()), ) })? .ok_or_else(|| { obscure_error_if_true( report_error_flag, - Status::not_found(format!("Tari genesis block not found")), + Status::not_found("Tari genesis block not found".to_string()), ) })? .hash() @@ -722,6 +722,23 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer { PowAlgorithm::Sha3x => new_block.header.mining_hash().to_vec(), PowAlgorithm::RandomX => new_block.header.merge_mining_hash().to_vec(), }; + let gen_hash = handler + .get_header(0) + .await + .map_err(|_| { + obscure_error_if_true( + report_error_flag, + Status::invalid_argument("Tari genesis block not found".to_string()), + ) + })? + .ok_or_else(|| { + obscure_error_if_true( + report_error_flag, + Status::not_found("Tari genesis block not found".to_string()), + ) + })? + .hash() + .to_vec(); let (header, block_body) = new_block.into_header_body(); let mut header_bytes = Vec::new(); @@ -736,6 +753,7 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer { block_body: block_body_bytes, merge_mining_hash: mining_hash, utxo_mr: header.output_mr.to_vec(), + tari_unique_id: gen_hash, }; debug!(target: LOG_TARGET, "Sending GetNewBlockBlob response to client"); Ok(Response::new(response))