@@ -138,6 +138,21 @@ async fn verify_standard_transaction(
138
138
let recipient = parse_recipient ( & request. recipient ) ?;
139
139
140
140
if !request. data . is_empty ( ) {
141
+ confirm:: confirm ( & confirm:: Params {
142
+ title : "Unknown\n contract" ,
143
+ body : "You will be shown\n the raw\n transaction data." ,
144
+ accept_is_nextarrow : true ,
145
+ ..Default :: default ( )
146
+ } )
147
+ . await ?;
148
+ confirm:: confirm ( & confirm:: Params {
149
+ title : "Unknown\n contract" ,
150
+ body : "Only proceed if you\n understand exactly\n what the data means." ,
151
+ accept_is_nextarrow : true ,
152
+ ..Default :: default ( )
153
+ } )
154
+ . await ?;
155
+
141
156
confirm:: confirm ( & confirm:: Params {
142
157
title : "Transaction\n data" ,
143
158
body : & hex:: encode ( & request. data ) ,
@@ -367,14 +382,21 @@ mod tests {
367
382
let _guard = MUTEX . lock ( ) . unwrap ( ) ;
368
383
369
384
const KEYPATH : & [ u32 ] = & [ 44 + HARDENED , 60 + HARDENED , 0 + HARDENED , 0 , 0 ] ;
370
-
385
+ static mut CONFIRM_COUNTER : u32 = 0 ;
371
386
mock ( Data {
372
387
ui_confirm_create : Some ( Box :: new ( |params| {
373
- assert_eq ! ( params. title, "Transaction\n data" ) ;
374
- assert_eq ! ( params. body, "666f6f20626172" ) ; // "foo bar" in hex.
375
- assert ! ( params. scrollable) ;
376
- assert_eq ! ( params. display_size, 7 ) ; // length of "foo bar"
377
- assert ! ( params. accept_is_nextarrow) ;
388
+ match unsafe { CONFIRM_COUNTER } {
389
+ 0 | 1 => assert_eq ! ( params. title, "Unknown\n contract" ) ,
390
+ 2 => {
391
+ assert_eq ! ( params. title, "Transaction\n data" ) ;
392
+ assert_eq ! ( params. body, "666f6f20626172" ) ; // "foo bar" in hex.
393
+ assert ! ( params. scrollable) ;
394
+ assert_eq ! ( params. display_size, 7 ) ; // length of "foo bar"
395
+ assert ! ( params. accept_is_nextarrow) ;
396
+ }
397
+ _ => panic ! ( "too many user confirmations" ) ,
398
+ }
399
+ unsafe { CONFIRM_COUNTER += 1 }
378
400
true
379
401
} ) ) ,
380
402
ui_transaction_address_create : Some ( Box :: new ( |amount, address| {
0 commit comments