Skip to content

Commit

Permalink
coin consolidation dialog: set default max block height to blockchain…
Browse files Browse the repository at this point in the history
… height + 1

Set a saner default value for max block height. Fallback on 10 000 000 if the block height is not available (values of 0 or -1 can be returned by `wallet.get_local_height` in some cases).
  • Loading branch information
PiRK committed Jan 27, 2023
1 parent 35aefbf commit 8a2d53c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions electrumabc_gui/qt/consolidate_coins_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __init__(
self.wallet: AbstractWallet = wallet
self.transactions: Sequence[Transaction] = []

self.coins_page = CoinSelectionPage()
self.coins_page = CoinSelectionPage(self.wallet.get_local_height())
self.addPage(self.coins_page)

self.output_page = OutputsPage(address)
Expand Down Expand Up @@ -213,7 +213,7 @@ def __init__(self):


class CoinSelectionPage(QtWidgets.QWizardPage):
def __init__(self, parent=None):
def __init__(self, blockchain_height, parent=None):
super().__init__(parent)
self.setTitle("Filter coins")

Expand Down Expand Up @@ -259,7 +259,9 @@ def __init__(self, parent=None):
)

self.maximum_height_sb = BlockHeightSpinBox()
self.maximum_height_sb.setValue(10_000_000)
self.maximum_height_sb.setValue(
blockchain_height + 1 if blockchain_height > 0 else 10_000_000
)
self.maximum_height_sb.valueChanged.connect(self.on_min_or_max_height_changed)
self.filter_by_max_height_cb = self.add_filter_by_value_line(
"Maximum block height", self.maximum_height_sb
Expand Down

0 comments on commit 8a2d53c

Please sign in to comment.