Skip to content

Commit

Permalink
fix: invert empty check
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Apr 5, 2024
1 parent 5d2c45c commit 51fb36d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions applications/minotari_node/src/grpc/base_node_grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl BaseNodeGrpcServer {
}

fn is_method_enabled(&self, grpc_method: GrpcMethod) -> bool {
let mining_method = vec![
let mining_method = [
GrpcMethod::GetVersion,
GrpcMethod::GetNewBlockTemplate,
GrpcMethod::GetNewBlock,
Expand All @@ -130,7 +130,7 @@ impl BaseNodeGrpcServer {
GrpcMethod::GetTipInfo,
];

let second_layer_methods = vec![
let second_layer_methods = [
GrpcMethod::GetVersion,
GrpcMethod::GetConstants,
GrpcMethod::GetMempoolTransactions,
Expand Down Expand Up @@ -1803,10 +1803,10 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer {
let mut handler = self.node_service.clone();
let (mut tx, rx) = mpsc::channel(1000);

let sidechain_id = if request.sidechain_id.is_empty() {
let sidechain_id = if !request.sidechain_id.is_empty() {
Some(
PublicKey::from_canonical_bytes(&request.sidechain_id)
.map_err(|e| Status::invalid_argument(format!("Invalid validator_network '{}'", e)))?,
.map_err(|e| Status::invalid_argument(format!("Invalid sidechain_id '{}'", e)))?,
)
} else {
None
Expand Down
4 changes: 2 additions & 2 deletions base_layer/core/src/chain_storage/blockchain_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,12 +1416,12 @@ pub fn calculate_validator_node_mr(
let mut hash_map = HashMap::new();
for ValidatorNodeRegistrationInfo {
public_key: pk,
sidechain_id: network,
sidechain_id: sidechain_id,
shard_key,
} in validator_nodes
{
hash_map
.entry(network.as_ref().map(|n| n.to_vec()).unwrap_or(vec![0u8; 32]))
.entry(sidechain_id.as_ref().map(|n| n.to_vec()).unwrap_or(vec![0u8; 32]))
.or_insert_with(|| Vec::with_capacity(1))
.push((pk, shard_key));
}
Expand Down

0 comments on commit 51fb36d

Please sign in to comment.