Skip to content

Commit

Permalink
fix: fix search_kernel command (#3157)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->
The search-kernel command in the base_node UI currently returns either an error, none or the block containing said kernel. 
The UI interprets a None as a successful command, but the block could not be found due to it being a pruned block. This is incorrect, as the returned block is always a `historical block`. `Historical blocks` can have pruned outputs in them. So when a block is pruned, the base_node will return the block with the information it can fill in, plus all pruned outputs. 

When a kernel is not found in the chain, the search commands returns Ok(None) and the UI now interprets this correctly as the kernel is not found. 

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
* [x] I'm merging against the `development` branch.
* [x] I have squashed my commits into a single commit.
  • Loading branch information
aviator-app[bot] authored Aug 5, 2021
2 parents ee13b53 + 9538f26 commit dc99898
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions applications/tari_base_node/src/command_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,8 @@ impl CommandHandler {
);
},
Ok(mut data) => match data.pop() {
Some(v) => println!("{}", v.block()),
_ => println!(
"Pruned node: kernel found, but block not found for kernel signature {}",
hex_sig
),
Some(v) => println!("{}", v),
_ => println!("No kernel with signature {} found", hex_sig),
},
};
});
Expand Down

0 comments on commit dc99898

Please sign in to comment.