bitbox02_rust/ui: inline verify_recipient
What changed, and why it matters
This commit is a simple code cleanup: it moves the recipient-confirmation logic directly into the user-interface layer and removes a small wrapper function that was no longer needed. There is no change to security behavior, no bug fix, and no new feature.
No security action required; review as ordinary refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch inlines transaction::verify_recipient into BitBox02Ui::verify_recipient in src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs and deletes the now-redundant verify_recipient wrapper from src/rust/bitbox02-rust/src/workflow/transaction.rs. The control flow—calling bitbox02::ui::confirm_transaction_address, mapping Approved to Ok(()) and Cancelled to Err(UserAbort)—remains identical. This is a pure refactoring with no functional change.
Changed components
src/rust/bitbox02-rust/src/hal/bitbox02/ui.rssrc/rust/bitbox02-rust/src/workflow/transaction.rsInspect captured patch +4 / −8
diff --git a/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs b/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
index d6f568a..33b5e50 100644
--- a/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
@@ -25,7 +25,10 @@ impl Ui for BitBox02Ui {
recipient: &str,
amount: &str,
) -> Result<(), transaction::UserAbort> {
- transaction::verify_recipient(recipient, amount).await
+ match bitbox02::ui::confirm_transaction_address(amount, recipient).await {
+ bitbox02::ui::ConfirmResponse::Approved => Ok(()),
+ bitbox02::ui::ConfirmResponse::Cancelled => Err(transaction::UserAbort),
+ }
}
#[inline(always)]
diff --git a/src/rust/bitbox02-rust/src/workflow/transaction.rs b/src/rust/bitbox02-rust/src/workflow/transaction.rs
index 0c4d722..ed87f56 100644
--- a/src/rust/bitbox02-rust/src/workflow/transaction.rs
+++ b/src/rust/bitbox02-rust/src/workflow/transaction.rs
@@ -6,13 +6,6 @@ use alloc::string::String;
pub struct UserAbort;
-pub async fn verify_recipient(recipient: &str, amount: &str) -> Result<(), UserAbort> {
- match bitbox02::ui::confirm_transaction_address(amount, recipient).await {
- bitbox02::ui::ConfirmResponse::Approved => Ok(()),
- bitbox02::ui::ConfirmResponse::Cancelled => Err(UserAbort),
- }
-}
-
fn format_percentage(p: f64) -> String {
let int: u64 = num_traits::float::FloatCore::round(p * 10.) as _;
util::decimal::format_no_trim(int, 1)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.