@@ -77,7 +77,7 @@ def __init__(self, *, title='',
77
77
self .no_dynfee_estimates = False
78
78
self .needs_update = False
79
79
# preview is disabled for lightning channel funding
80
- self .allow_preview = allow_preview
80
+ self ._allow_preview = allow_preview
81
81
self .is_preview = False
82
82
83
83
self .locktime_e = LockTimeEdit (self )
@@ -103,14 +103,20 @@ def __init__(self, *, title='',
103
103
vbox .addStretch (1 )
104
104
vbox .addLayout (buttons )
105
105
106
- self .set_io_visible (self . config . GUI_QT_TX_EDITOR_SHOW_IO )
106
+ self .set_io_visible ()
107
107
self .set_fee_edit_visible (self .config .GUI_QT_TX_EDITOR_SHOW_FEE_DETAILS )
108
108
self .set_locktime_visible (self .config .GUI_QT_TX_EDITOR_SHOW_LOCKTIME )
109
109
self .update_fee_target ()
110
110
self .resize (self .layout ().sizeHint ())
111
111
112
112
self .main_window .gui_object .timer .timeout .connect (self .timer_actions )
113
113
114
+ def is_batching (self ):
115
+ return self .config .WALLET_BATCH_RBF and not self .main_window .utxo_list .is_coincontrol_active ()
116
+
117
+ def should_show_io (self ):
118
+ return self .config .GUI_QT_TX_EDITOR_SHOW_IO
119
+
114
120
def timer_actions (self ):
115
121
if self .needs_update :
116
122
self .update ()
@@ -363,10 +369,13 @@ def update_fee_fields(self):
363
369
# feerate_label needs to be updated from feerate_e
364
370
self .update_feerate_label ()
365
371
372
+ def allow_preview (self ):
373
+ return self ._allow_preview and not self .is_batching ()
374
+
366
375
def create_buttons_bar (self ):
367
376
self .preview_button = QPushButton (_ ('Preview' ))
368
377
self .preview_button .clicked .connect (self .on_preview )
369
- self .preview_button .setVisible (self .allow_preview )
378
+ self .preview_button .setVisible (self .allow_preview () )
370
379
self .ok_button = QPushButton (_ ('OK' ))
371
380
self .ok_button .clicked .connect (self .on_send )
372
381
self .ok_button .setDefault (True )
@@ -450,7 +459,10 @@ def toggle_multiple_change(self):
450
459
def toggle_batch_rbf (self ):
451
460
b = not self .config .WALLET_BATCH_RBF
452
461
self .config .WALLET_BATCH_RBF = b
462
+ self .set_io_visible ()
463
+ self .resize_to_fit_content ()
453
464
self .trigger_update ()
465
+ self .preview_button .setVisible (self .allow_preview ())
454
466
455
467
def toggle_merge_duplicate_outputs (self ):
456
468
b = not self .config .WALLET_MERGE_DUPLICATE_OUTPUTS
@@ -470,7 +482,7 @@ def toggle_confirmed_only(self):
470
482
def toggle_io_visibility (self ):
471
483
b = not self .config .GUI_QT_TX_EDITOR_SHOW_IO
472
484
self .config .GUI_QT_TX_EDITOR_SHOW_IO = b
473
- self .set_io_visible (b )
485
+ self .set_io_visible ()
474
486
self .resize_to_fit_content ()
475
487
476
488
def toggle_fee_details (self ):
@@ -485,7 +497,8 @@ def toggle_locktime(self):
485
497
self .set_locktime_visible (b )
486
498
self .resize_to_fit_content ()
487
499
488
- def set_io_visible (self , b ):
500
+ def set_io_visible (self ):
501
+ b = self .should_show_io ()
489
502
self .io_widget .setVisible (b )
490
503
491
504
def set_fee_edit_visible (self , b ):
@@ -552,31 +565,33 @@ def get_messages(self):
552
565
assert fee is not None
553
566
amount = self .tx .output_value () if self .output_value == '!' else self .output_value
554
567
tx_size = self .tx .estimated_size ()
555
- fee_warning_tuple = self .wallet .get_tx_fee_warning (
556
- invoice_amt = amount , tx_size = tx_size , fee = fee )
557
- if fee_warning_tuple :
558
- allow_send , long_warning , short_warning = fee_warning_tuple
559
- if not allow_send :
560
- self .error = long_warning
561
- else :
562
- messages .append (long_warning )
563
- if self .tx .has_dummy_output (DummyAddress .SWAP ):
568
+ if not self .is_batching ():
569
+ fee_warning_tuple = self .wallet .get_tx_fee_warning (
570
+ invoice_amt = amount , tx_size = tx_size , fee = fee )
571
+ if fee_warning_tuple :
572
+ allow_send , long_warning , short_warning = fee_warning_tuple
573
+ if not allow_send :
574
+ self .error = long_warning
575
+ else :
576
+ messages .append (long_warning )
577
+ if self .tx .get_dummy_output (DummyAddress .SWAP ):
564
578
messages .append (_ ('This transaction will send funds to a submarine swap.' ))
565
579
# warn if spending unconf
566
580
if any ((txin .block_height is not None and txin .block_height <= 0 ) for txin in self .tx .inputs ()):
567
581
messages .append (_ ('This transaction will spend unconfirmed coins.' ))
568
582
# warn if we merge from mempool
569
- if self .tx .rbf_merge_txid :
570
- messages .append (_ ('This payment will be merged with another existing transaction.' ))
571
- # warn if we use multiple change outputs
572
- num_change = sum (int (o .is_change ) for o in self .tx .outputs ())
573
- num_ismine = sum (int (o .is_mine ) for o in self .tx .outputs ())
574
- if num_change > 1 :
575
- messages .append (_ ('This transaction has {} change outputs.' .format (num_change )))
576
- # warn if there is no ismine output, as it might be problematic to RBF the tx later.
577
- # (though RBF is still possible by adding new inputs, if the wallet has more utxos)
578
- if num_ismine == 0 :
579
- messages .append (_ ('Make sure you pay enough mining fees; you will not be able to bump the fee later.' ))
583
+ if self .is_batching ():
584
+ messages .append (_ ('Transaction batching is active. The fee will be bumped automatically if needed' ))
585
+ else :
586
+ # warn if we use multiple change outputs
587
+ num_change = sum (int (o .is_change ) for o in self .tx .outputs ())
588
+ num_ismine = sum (int (o .is_mine ) for o in self .tx .outputs ())
589
+ if num_change > 1 :
590
+ messages .append (_ ('This transaction has {} change outputs.' .format (num_change )))
591
+ # warn if there is no ismine output, as it might be problematic to RBF the tx later.
592
+ # (though RBF is still possible by adding new inputs, if the wallet has more utxos)
593
+ if num_ismine == 0 :
594
+ messages .append (_ ('Make sure you pay enough mining fees; you will not be able to bump the fee later.' ))
580
595
581
596
# TODO: warn if we send change back to input address
582
597
return messages
@@ -637,16 +652,17 @@ def _update_amount_label(self):
637
652
def update_tx (self , * , fallback_to_zero_fee : bool = False ):
638
653
fee_estimator = self .get_fee_estimator ()
639
654
confirmed_only = self .config .WALLET_SPEND_CONFIRMED_ONLY
655
+ is_batching = self .is_batching ()
640
656
try :
641
- self .tx = self .make_tx (fee_estimator , confirmed_only = confirmed_only )
657
+ self .tx = self .make_tx (fee_estimator , confirmed_only = confirmed_only , is_batching = is_batching )
642
658
self .not_enough_funds = False
643
659
self .no_dynfee_estimates = False
644
660
except NotEnoughFunds :
645
661
self .not_enough_funds = True
646
662
self .tx = None
647
663
if fallback_to_zero_fee :
648
664
try :
649
- self .tx = self .make_tx (0 , confirmed_only = confirmed_only )
665
+ self .tx = self .make_tx (0 , confirmed_only = confirmed_only , is_batching = is_batching )
650
666
except BaseException :
651
667
return
652
668
else :
@@ -655,7 +671,7 @@ def update_tx(self, *, fallback_to_zero_fee: bool = False):
655
671
self .no_dynfee_estimates = True
656
672
self .tx = None
657
673
try :
658
- self .tx = self .make_tx (0 , confirmed_only = confirmed_only )
674
+ self .tx = self .make_tx (0 , confirmed_only = confirmed_only , is_batching = is_batching )
659
675
except NotEnoughFunds :
660
676
self .not_enough_funds = True
661
677
return
@@ -670,7 +686,7 @@ def update_tx(self, *, fallback_to_zero_fee: bool = False):
670
686
def can_pay_assuming_zero_fees (self , confirmed_only ) -> bool :
671
687
# called in send_tab.py
672
688
try :
673
- tx = self .make_tx (0 , confirmed_only = confirmed_only )
689
+ tx = self .make_tx (0 , confirmed_only = confirmed_only , is_batching = False )
674
690
except NotEnoughFunds :
675
691
return False
676
692
else :
0 commit comments