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