Skip to content

Commit

Permalink
Merge #3888
Browse files Browse the repository at this point in the history
3888: feat: revalidate ui command r=delta1 a=SWvheerden

Description
---
Add a UI command to call the revalidate all outputs and transactions from a wallet. Currently, this is only supported by GRPC command. 




Co-authored-by: SW van Heerden <swvheerden@gmail.com>
Co-authored-by: Philip Robinson <simian@tari.com>
Co-authored-by: Byron Hambly <bizzle@tari.com>
  • Loading branch information
4 people authored Mar 3, 2022
2 parents fc516a4 + b755e78 commit a099f14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ impl Display for ParsedCommand {
MintTokens => "mint-tokens",
CreateInitialCheckpoint => "create-initial-checkpoint",
CreateCommitteeDefinition => "create-committee-definition",
RevalidateWalletDb => "revalidate-wallet-db",
};

let args = self
Expand Down Expand Up @@ -143,6 +144,7 @@ pub fn parse_command(command: &str) -> Result<ParsedCommand, ParseError> {
MintTokens => parser_builder(args).pub_key().text_array().build()?,
CreateInitialCheckpoint => parser_builder(args).pub_key().text().build()?,
CreateCommitteeDefinition => parser_builder(args).pub_key().pub_key_array().build()?,
RevalidateWalletDb => Vec::new(),
};

Ok(ParsedCommand { command, args })
Expand Down
11 changes: 11 additions & 0 deletions applications/tari_console_wallet/src/automation/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub enum WalletCommand {
MintTokens,
CreateInitialCheckpoint,
CreateCommitteeDefinition,
RevalidateWalletDb,
}

#[derive(Debug, EnumString, PartialEq, Clone)]
Expand Down Expand Up @@ -923,6 +924,16 @@ pub async fn command_runner(
.await?;
println!("Done!");
},
RevalidateWalletDb => {
output_service
.revalidate_all_outputs()
.await
.map_err(CommandError::OutputManagerError)?;
transaction_service
.revalidate_all_transactions()
.await
.map_err(CommandError::TransactionServiceError)?;
},
}
}

Expand Down

0 comments on commit a099f14

Please sign in to comment.