What changed, and why it matters
This commit only updates test code so that automated Rust tests compile and pass again. It does not change any production wallet code, so it cannot directly affect user funds or device security.
No security action required. Treat as routine test maintenance. If desired, verify that the production OverviewTo/is_mine logic elsewhere in the codebase already handles these cases correctly, since the tests now assert more granular ownership flags.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is confined to two test modules. In address.rs, a unit test that expects an invalid network error now uses Network::BitcoinCash instead of Network::Litecoin, likely because the underlying library removed or changed the Litecoin variant. In lib.rs, a test macro for transaction overviews is updated to accept per-output (address, is_mine, is_external) tuples instead of plain address strings, and test call sites are updated accordingly. Another macro now derives is_mine from whether a derivation path string is non-empty. These are purely test-data/test-harness adjustments.
Changed components
rust/apps/bitcoin/src/addresses/address.rs (test module only)rust/apps/bitcoin/src/lib.rs (test module only)Inspect captured patch +22 / −16
diff --git a/rust/apps/bitcoin/src/addresses/address.rs b/rust/apps/bitcoin/src/addresses/address.rs
index d38fff3..3b5c599 100644
--- a/rust/apps/bitcoin/src/addresses/address.rs
+++ b/rust/apps/bitcoin/src/addresses/address.rs
@@ -605,7 +605,7 @@ mod tests {
#[test]
fn test_address_p2wpkh_invalid_network() {
let pk = sample_pubkey();
- let result = Address::p2wpkh(&pk, Network::Litecoin);
+ let result = Address::p2wpkh(&pk, Network::BitcoinCash);
assert!(matches!(result, Err(BitcoinError::AddressError(_))));
}
diff --git a/rust/apps/bitcoin/src/lib.rs b/rust/apps/bitcoin/src/lib.rs
index 773450a..6ee7bfc 100644
--- a/rust/apps/bitcoin/src/lib.rs
+++ b/rust/apps/bitcoin/src/lib.rs
@@ -153,10 +153,16 @@ mod test {
from: $from.iter().map(|i| i.to_string()).collect(),
to: $to
.iter()
- .map(|i| OverviewTo {
- address: i.to_string(),
- is_mine: false,
- is_external: false,
+ .map(|i| {
+ if let (addr, is_mine, is_external) = i {
+ OverviewTo {
+ address: addr.to_string(),
+ is_mine: *is_mine,
+ is_external: *is_external,
+ }
+ } else {
+ unreachable!()
+ }
})
.collect(),
network: $network.to_string(),
@@ -191,7 +197,7 @@ mod test {
amount: $amount.to_string(),
value: $value,
path: Some($path.to_string()),
- is_mine: true,
+ is_mine: !$path.is_empty(),
is_external: false,
}
};
@@ -255,8 +261,8 @@ mod test {
"2250 sats",
vec!("MWAVYuwzx3bkqHNKBQtYDxSvzzw6DQnJwo"),
vec![
- "MG67WAWZ6jEmA97LWuERJTkBB7pHMoVfgj",
- "MWAVYuwzx3bkqHNKBQtYDxSvzzw6DQnJwo"
+ ("MG67WAWZ6jEmA97LWuERJTkBB7pHMoVfgj", false, true),
+ ("MWAVYuwzx3bkqHNKBQtYDxSvzzw6DQnJwo", true, false)
],
"Litecoin",
false
@@ -316,8 +322,8 @@ mod test {
"2250 sats",
vec!["XciiKrSHgdFkuL9FTT31qRfTPNUVxX4sPc"],
vec![
- "Xb9LAffWjcxTCN5GMj5kbZiqN5g7nnkgrv",
- "XciiKrSHgdFkuL9FTT31qRfTPNUVxX4sPc"
+ ("Xb9LAffWjcxTCN5GMj5kbZiqN5g7nnkgrv", false, true),
+ ("XciiKrSHgdFkuL9FTT31qRfTPNUVxX4sPc", true, false)
],
"Dash",
false
@@ -376,8 +382,8 @@ mod test {
"2250 sats",
vec!["qpfs2gcfwg322segkj4h30du4vtjyvsxtq6msk90a5"],
vec![
- "qpfs2gcfwg322segkj4h30du4vtjyvsxtq6msk90a5",
- "qpt4cr4juduwl36w35rwfwvz6am2z7mxcg8a84k28n",
+ ("qpfs2gcfwg322segkj4h30du4vtjyvsxtq6msk90a5", true, false),
+ ("qpt4cr4juduwl36w35rwfwvz6am2z7mxcg8a84k28n", false, true),
],
"Bitcoin Cash",
false
@@ -437,8 +443,8 @@ mod test {
"3150 sats",
vec!["bc1qaukjm4glwmt8ghx5fmp92rgw3xa40xdmp2t8lr"],
vec![
- "bc1qksq4ax9jpqqmumwfhg54ktwh29627zf78237wp",
- "bc1qx9yy32cq623qyr88ygkjgvjglu0kz665d0m9f9"
+ ("bc1qksq4ax9jpqqmumwfhg54ktwh29627zf78237wp", false, true),
+ ("bc1qx9yy32cq623qyr88ygkjgvjglu0kz665d0m9f9", true, false)
],
"Bitcoin Mainnet",
false
@@ -500,7 +506,7 @@ mod test {
"36kTQjs54H29LRhL9WiBSFbNtUyNMNCpEv",
"3G8X84wtGDtiENAYagDSBcofp7NkjqHJFS"
],
- vec!["3NNSqAz3LajNv6eSQtn237CtPaHdJdYPVR"],
+ vec![("3NNSqAz3LajNv6eSQtn237CtPaHdJdYPVR", false, true)],
"Bitcoin Mainnet",
false
);
@@ -561,7 +567,7 @@ mod test {
"1NVWpSCxyzpPgSeGRs4zqFciZ7N1UEQtEc",
"1PCUEmiFARh3FSLJXgzDGDeKtKqg8eMMPm",
],
- vec!["bc1qksq4ax9jpqqmumwfhg54ktwh29627zf78237wp"],
+ vec![("bc1qksq4ax9jpqqmumwfhg54ktwh29627zf78237wp", false, true)],
"Bitcoin Mainnet",
true
);
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.