skip willexecutor with dust amount
This commit is contained in:
3
heirs.py
3
heirs.py
@@ -435,6 +435,7 @@ class Heirs(dict, Logger):
|
||||
if int(Util.int_locktime(locktime)) > int(from_locktime):
|
||||
try:
|
||||
base_fee = int(willexecutor["base_fee"])
|
||||
if base_fee > dust_threshold:
|
||||
willexecutors_amount += base_fee
|
||||
h = [None] * 4
|
||||
h[HEIR_AMOUNT] = base_fee
|
||||
@@ -537,7 +538,7 @@ class Heirs(dict, Logger):
|
||||
break
|
||||
elif 0 <= j:
|
||||
url, willexecutor = willexecutorsitems[j]
|
||||
if not Willexecutors.is_selected(willexecutor):
|
||||
if not Willexecutors.is_selected(willexecutor) or willexecutor["base_fee"] < wallet.dust_threshold():
|
||||
continue
|
||||
else:
|
||||
willexecutor["url"] = url
|
||||
|
||||
57
qt.py
57
qt.py
@@ -495,8 +495,8 @@ class BalWindow(Logger):
|
||||
Util.copy(self.will_settings, self.bal_plugin.default_will_settings())
|
||||
self.logger.debug("not_will_settings {}".format(self.will_settings))
|
||||
self.bal_plugin.validate_will_settings(self.will_settings)
|
||||
self.heir_list.update_will_settings()
|
||||
self.heir_list.update()
|
||||
self.heir_list_widget.update_will_settings()
|
||||
self.heir_list_widget.update()
|
||||
|
||||
def init_wizard(self):
|
||||
wizard_dialog = BalWizardDialog(self)
|
||||
@@ -507,9 +507,9 @@ class BalWindow(Logger):
|
||||
self.willexecutor_dialog.show()
|
||||
|
||||
def create_heirs_tab(self):
|
||||
self.heir_list = HeirList(self, self.window)
|
||||
self.heir_list_widget = HeirListWidget(self, self.window)
|
||||
|
||||
tab = self.window.create_list_tab(self.heir_list)
|
||||
tab = self.window.create_list_tab(self.heir_list_widget)
|
||||
tab.is_shown_cv = shown_cv(False)
|
||||
return tab
|
||||
|
||||
@@ -616,7 +616,7 @@ class BalWindow(Logger):
|
||||
|
||||
h = Heirs.validate_heir(heir[0], heir[1:])
|
||||
self.heirs[heir[0]] = h
|
||||
self.heir_list.update()
|
||||
self.heir_list_widget.update()
|
||||
return True
|
||||
|
||||
def delete_heirs(self, heirs):
|
||||
@@ -627,14 +627,14 @@ class BalWindow(Logger):
|
||||
_logger.debug(f"error deleting heir: {heir} {e}")
|
||||
pass
|
||||
self.heirs.save()
|
||||
self.heir_list.update()
|
||||
self.heir_list_widget.update()
|
||||
return True
|
||||
|
||||
def import_heirs(
|
||||
self,
|
||||
):
|
||||
import_meta_gui(
|
||||
self.window, _("heirs"), self.heirs.import_file, self.heir_list.update
|
||||
self.window, _("heirs"), self.heirs.import_file, self.heir_list_widget.update
|
||||
)
|
||||
|
||||
def export_heirs(self):
|
||||
@@ -1196,7 +1196,7 @@ class BalWindow(Logger):
|
||||
def on_success(result):
|
||||
# del self.waiting_dialog
|
||||
try:
|
||||
parent.willexecutor_list.update()
|
||||
parent.will_executor_list_widget.update()
|
||||
except Exception as e:
|
||||
pass
|
||||
try:
|
||||
@@ -1622,7 +1622,7 @@ class BalWizardDialog(BalDialog):
|
||||
|
||||
def closeEvent(self, event):
|
||||
self.bal_window.update_all()
|
||||
self.bal_window.heir_list.update_will_settings()
|
||||
self.bal_window.heir_list_widget.update_will_settings()
|
||||
pass
|
||||
|
||||
|
||||
@@ -1699,7 +1699,7 @@ class BalWizardHeirsWidget(BalWizardWidget):
|
||||
)
|
||||
|
||||
def get_content(self):
|
||||
self.heirs_list = HeirList(self.bal_window, self)
|
||||
self.heir_list_widget = HeirListWidget(self.bal_window, self)
|
||||
button_add = QPushButton(_("Add"))
|
||||
button_add.clicked.connect(self.add_heir)
|
||||
button_import = QPushButton(_("Import"))
|
||||
@@ -1708,20 +1708,20 @@ class BalWizardHeirsWidget(BalWizardWidget):
|
||||
button_export.clicked.connect(self.export_to_file)
|
||||
widget = QWidget()
|
||||
vbox = QVBoxLayout(widget)
|
||||
vbox.addWidget(self.heirs_list)
|
||||
vbox.addWidget(self.heir_list_widget)
|
||||
vbox.addLayout(Buttons(button_add, button_import, button_export))
|
||||
return widget
|
||||
|
||||
def import_from_file(self):
|
||||
self.bal_window.import_heirs()
|
||||
self.heirs_list.update()
|
||||
self.heir_list_widget.update()
|
||||
|
||||
def export_to_file(self):
|
||||
self.bal_window.export_heirs()
|
||||
|
||||
def add_heir(self):
|
||||
self.bal_window.new_heir_dialog()
|
||||
self.heirs_list.update()
|
||||
self.heir_list_widget.update()
|
||||
|
||||
def validate(self):
|
||||
return True
|
||||
@@ -2487,7 +2487,7 @@ class BalBuildWillDialog(BalDialog):
|
||||
pass
|
||||
|
||||
|
||||
class HeirList(MyTreeView, MessageBoxMixin):
|
||||
class HeirListWidget(MyTreeView, MessageBoxMixin):
|
||||
class Columns(MyTreeView.BaseColumnsEnum):
|
||||
NAME = enum.auto()
|
||||
ADDRESS = enum.auto()
|
||||
@@ -2502,9 +2502,16 @@ class HeirList(MyTreeView, MessageBoxMixin):
|
||||
|
||||
ROLE_SORT_ORDER = Qt.ItemDataRole.UserRole + 1000
|
||||
|
||||
ROLE_HEIR_KEY = Qt.ItemDataRole.UserRole + 1001
|
||||
ROLE_HEIR_KEY = Qt.ItemDataRole.UserRole + 4000
|
||||
key_role = ROLE_HEIR_KEY
|
||||
|
||||
def createEditor(self, parent, option, index):
|
||||
return QLineEdit(parent)
|
||||
def setEditorData(self, editor, index):
|
||||
editor.setText(index.data())
|
||||
def setModelData(self, editor, model, index):
|
||||
model.setData(index, editor.text())
|
||||
|
||||
def __init__(self, bal_window: "BalWindow", parent):
|
||||
super().__init__(
|
||||
parent=parent,
|
||||
@@ -3317,7 +3324,7 @@ class WillWidget(QWidget):
|
||||
hlayout.addWidget(WillWidget(w, parent=parent))
|
||||
|
||||
|
||||
class WillExecutorList(MyTreeView):
|
||||
class WillExecutorListWidget(MyTreeView):
|
||||
class Columns(MyTreeView.BaseColumnsEnum):
|
||||
SELECTED = enum.auto()
|
||||
URL = enum.auto()
|
||||
@@ -3562,7 +3569,7 @@ class WillExecutorWidget(QWidget, MessageBoxMixin):
|
||||
self.willexecutors_list = Willexecutors.get_willexecutors(self.bal_plugin)
|
||||
|
||||
self.size_label = QLabel()
|
||||
self.willexecutor_list = WillExecutorList(self)
|
||||
self.will_executor_list_widget = WillExecutorListWidget(self)
|
||||
|
||||
vbox = QVBoxLayout(self)
|
||||
vbox.addWidget(self.size_label)
|
||||
@@ -3579,7 +3586,7 @@ class WillExecutorWidget(QWidget, MessageBoxMixin):
|
||||
hbox.addWidget(spacer_widget)
|
||||
vbox.addWidget(widget)
|
||||
|
||||
vbox.addWidget(self.willexecutor_list)
|
||||
vbox.addWidget(self.will_executor_list_widget)
|
||||
buttonbox = QHBoxLayout()
|
||||
|
||||
b = QPushButton(_("Add"))
|
||||
@@ -3603,7 +3610,7 @@ class WillExecutorWidget(QWidget, MessageBoxMixin):
|
||||
buttonbox.addWidget(b)
|
||||
|
||||
vbox.addLayout(buttonbox)
|
||||
# self.willexecutor_list.update()
|
||||
# self.will_executor_list_widget.update()
|
||||
|
||||
def add(self):
|
||||
self.willexecutors_list["http://localhost:8080"] = {
|
||||
@@ -3611,11 +3618,11 @@ class WillExecutorWidget(QWidget, MessageBoxMixin):
|
||||
"base_fee": 0,
|
||||
"status": "-1",
|
||||
}
|
||||
self.willexecutor_list.update()
|
||||
self.will_executor_list_widget.update()
|
||||
|
||||
def download_list(self):
|
||||
self.willexecutors_list.update(Willexecutors.download_list(self.bal_window.willexecutors))
|
||||
self.willexecutor_list.update()
|
||||
self.will_executor_list_widget.update()
|
||||
|
||||
def export_file(self, path):
|
||||
Util.export_meta_gui(
|
||||
@@ -3638,13 +3645,13 @@ class WillExecutorWidget(QWidget, MessageBoxMixin):
|
||||
wes = self.willexecutors_list
|
||||
self.bal_window.ping_willexecutors(wes, self.parent)
|
||||
self.willexecutors_list.update(wes)
|
||||
self.willexecutor_list.update()
|
||||
self.will_executor_list_widget.update()
|
||||
|
||||
def import_json_file(self, path):
|
||||
data = read_json_file(path)
|
||||
data = self._validate(data)
|
||||
self.willexecutors_list.update(data)
|
||||
self.willexecutor_list.update()
|
||||
self.will_executor_list_widget.update()
|
||||
|
||||
# TODO validate willexecutor json import file
|
||||
def _validate(self, data):
|
||||
@@ -3668,10 +3675,10 @@ class WillExecutorDialog(BalDialog, MessageBoxMixin):
|
||||
self.setMinimumSize(1000, 200)
|
||||
|
||||
vbox = QVBoxLayout(self)
|
||||
self.willexecutor_list = WillExecutorWidget(
|
||||
self.will_executor_list_widget = WillExecutorWidget(
|
||||
self, self.bal_window, self.willexecutors_list
|
||||
)
|
||||
vbox.addWidget(self.willexecutor_list)
|
||||
vbox.addWidget(self.will_executor_list_widget)
|
||||
|
||||
def is_hidden(self):
|
||||
return self.isMinimized() or self.isHidden()
|
||||
|
||||
Reference in New Issue
Block a user