Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Jan 26, 2024
1 parent 79b1d82 commit 48429ed
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions applications/minotari_app_grpc/proto/base_node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 21 additions & 3 deletions applications/minotari_node/src/grpc/base_node_grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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();
Expand All @@ -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))
Expand Down

0 comments on commit 48429ed

Please sign in to comment.