@@ -387,7 +387,7 @@ static bool layoutConfluxConfirmTx(
387
387
uint8_t * to , uint32_t to_len , const char * signer , const uint8_t * value ,
388
388
uint32_t value_len , const ConfluxTokenType * token , uint32_t chain_ids ,
389
389
const uint8_t * gas_price , uint32_t gas_price_len , const uint8_t * gas_limit ,
390
- uint32_t gas_limit_len , bool has_data ) {
390
+ uint32_t gas_limit_len , const uint8_t * data , uint32_t data_len ) {
391
391
bignum256 val = {0 }, gas = {0 };
392
392
uint8_t pad_val [32 ] = {0 };
393
393
char gas_value [32 ] = {0 };
@@ -414,17 +414,12 @@ static bool layoutConfluxConfirmTx(
414
414
} else {
415
415
strlcpy (to_str , _ ("to new contract?" ), sizeof (to_str ));
416
416
}
417
+ confluxFormatAmount (& val , token , amount , sizeof (amount ));
417
418
if (token == NULL ) {
418
- if (bn_is_zero (& val ) && has_data ) {
419
- strcpy (amount , _ ("message" )); // contract
420
- } else {
421
- confluxFormatAmount (& val , NULL , amount , sizeof (amount ));
422
- return layoutTransactionSign (
423
- "Conflux" , 0 , false, amount , to_str , signer , NULL , NULL , NULL , 0 ,
424
- _ ("Maximum Fee:" ), gas_value , NULL , NULL , NULL , NULL , NULL , NULL );
425
- }
419
+ return layoutTransactionSign ("Conflux" , 0 , false, amount , to_str , signer ,
420
+ NULL , NULL , data , data_len , _ ("Maximum Fee:" ),
421
+ gas_value , NULL , NULL , NULL , NULL , NULL , NULL );
426
422
} else {
427
- confluxFormatAmount (& val , token , amount , sizeof (amount ));
428
423
return layoutTransactionSign ("Conflux" , 0 , true, amount , to_str , signer ,
429
424
NULL , NULL , NULL , 0 , _ ("Maximum Fee" ),
430
425
gas_value , NULL , NULL , NULL , NULL , NULL , NULL );
@@ -565,36 +560,24 @@ void conflux_signing_init(ConfluxSignTx *msg, const HDNode *node) {
565
560
}
566
561
567
562
if (token != NULL ) {
568
- if (!layoutConfluxConfirmTx (
569
- msg -> data_initial_chunk .bytes + 16 , 20 , signer ,
570
- msg -> data_initial_chunk . bytes + 36 , 32 , token , msg -> chain_id ,
571
- msg -> gas_price . bytes , msg -> gas_price .size , msg -> gas_limit .bytes ,
572
- msg -> gas_limit .size , data_total > 0 ? true : false )) {
563
+ if (!layoutConfluxConfirmTx (msg -> data_initial_chunk . bytes + 16 , 20 , signer ,
564
+ msg -> data_initial_chunk .bytes + 36 , 32 , token ,
565
+ msg -> chain_id , msg -> gas_price . bytes ,
566
+ msg -> gas_price .size , msg -> gas_limit .bytes ,
567
+ msg -> gas_limit .size , NULL , 0 )) {
573
568
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
574
569
conflux_signing_abort ();
575
570
return ;
576
571
}
577
572
} else {
578
- if (toset ) {
579
- if (!layoutConfluxConfirmTx (pubkeyhash , 20 , signer , msg -> value .bytes ,
580
- msg -> value .size , NULL , msg -> chain_id ,
581
- msg -> gas_price .bytes , msg -> gas_price .size ,
582
- msg -> gas_limit .bytes , msg -> gas_limit .size ,
583
- data_total > 0 ? true : false)) {
584
- fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
585
- conflux_signing_abort ();
586
- return ;
587
- }
588
- } else {
589
- if (!layoutConfluxConfirmTx (pubkeyhash , 0 , signer , msg -> value .bytes ,
590
- msg -> value .size , NULL , msg -> chain_id ,
591
- msg -> gas_price .bytes , msg -> gas_price .size ,
592
- msg -> gas_limit .bytes , msg -> gas_limit .size ,
593
- data_total > 0 ? true : false)) {
594
- fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
595
- conflux_signing_abort ();
596
- return ;
597
- }
573
+ if (!layoutConfluxConfirmTx (
574
+ pubkeyhash , toset ? 20 : 0 , signer , msg -> value .bytes ,
575
+ msg -> value .size , NULL , msg -> chain_id , msg -> gas_price .bytes ,
576
+ msg -> gas_price .size , msg -> gas_limit .bytes , msg -> gas_limit .size ,
577
+ msg -> data_initial_chunk .bytes , msg -> data_initial_chunk .size )) {
578
+ fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
579
+ conflux_signing_abort ();
580
+ return ;
598
581
}
599
582
}
600
583
0 commit comments