Commit f5d999e pythcoiner
committed
1 parent 3fcbb0b commit f5d999e Copy full SHA for f5d999e
File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -521,7 +521,9 @@ impl Recipient {
521
521
}
522
522
}
523
523
view:: CreateSpendMessage :: RecipientEdited ( _, "amount" , amount) => {
524
- self . amount . value = amount;
524
+ if let Some ( a) = amount_checked ( amount) {
525
+ self . amount . value = a;
526
+ }
525
527
if !self . amount . value . is_empty ( ) {
526
528
self . amount . valid = self . amount ( ) . is_ok ( ) ;
527
529
} else {
@@ -627,3 +629,16 @@ impl Step for SaveSpend {
627
629
}
628
630
}
629
631
}
632
+
633
+ fn amount_checked ( input : String ) -> Option < String > {
634
+ match input. split_once ( '.' ) {
635
+ Some ( ( _, decimals) ) => {
636
+ if decimals. len ( ) > 8 {
637
+ None
638
+ } else {
639
+ Some ( input. to_string ( ) )
640
+ }
641
+ }
642
+ None => Some ( input. to_string ( ) ) ,
643
+ }
644
+ }
You can’t perform that action at this time.
0 commit comments