__version__0.2.7
This commit is contained in:
2
bal.py
2
bal.py
@@ -48,7 +48,7 @@ class BalConfig:
|
||||
|
||||
class BalPlugin(BasePlugin):
|
||||
_version=None
|
||||
|
||||
__version__ = "0.2.7" #AUTOMATICALLY GENERATED DO NOT EDIT
|
||||
def version(self):
|
||||
if not self._version:
|
||||
try:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "BAL",
|
||||
"fullname": "Bitcoin After Life",
|
||||
"description": "Provides free and decentralized inheritance support<br> Version: 0.2.6",
|
||||
"description": "Provides free and decentralized inheritance support<br> Version: 0.2.7",
|
||||
"author":"Svatantrya",
|
||||
"available_for": ["qt"],
|
||||
"icon":"icons/bal32x32.png"
|
||||
|
||||
13
qt.py
13
qt.py
@@ -1060,7 +1060,7 @@ class BalWindow(Logger):
|
||||
self.waiting_dialog.update(getMsg(willexecutors))
|
||||
if "txs" in willexecutor:
|
||||
try:
|
||||
if Willexecutors.push_transactions_to_willexecutor(self.bal_plugin,
|
||||
if Willexecutors.push_transactions_to_willexecutor(
|
||||
willexecutors[url]
|
||||
):
|
||||
for wid in willexecutors[url]["txsids"]:
|
||||
@@ -1082,7 +1082,6 @@ class BalWindow(Logger):
|
||||
w = self.willitems[wid]
|
||||
w.set_check_willexecutor(
|
||||
Willexecutors.check_transaction(
|
||||
self.bal_plugin,
|
||||
w._id,
|
||||
w.we["url"]
|
||||
)
|
||||
@@ -1184,7 +1183,7 @@ class BalWindow(Logger):
|
||||
self.waiting_dialog.update(get_title())
|
||||
except Exception:
|
||||
pass
|
||||
wes[url] = Willexecutors.get_info_task(self.bal_plugin, url, we)
|
||||
wes[url] = Willexecutors.get_info_task(url, we)
|
||||
if wes[url]["status"] == "KO":
|
||||
failed.append(url)
|
||||
else:
|
||||
@@ -1793,7 +1792,7 @@ class BalWizardWEDownloadWidget(BalWizardWidget):
|
||||
_logger.debug(f"Failed to download willexecutors list {fail}")
|
||||
pass
|
||||
|
||||
task = partial(Willexecutors.download_list, self.bal_window.bal_plugin,self.bal_window.willexecutors)
|
||||
task = partial(Willexecutors.download_list,self.bal_window.willexecutors)
|
||||
msg = _("Downloading Will-Executors list")
|
||||
self.waiting_dialog = BalWaitingDialog(
|
||||
self.bal_window, msg, task, on_success, on_failure, exe=False
|
||||
@@ -2246,7 +2245,7 @@ class BalBuildWillDialog(BalDialog):
|
||||
self.bal_window.willexecutors.get(url)
|
||||
):
|
||||
_logger.debug(f"{url}: {willexecutor}")
|
||||
if not Willexecutors.push_transactions_to_willexecutor(self.bal_plugin,
|
||||
if not Willexecutors.push_transactions_to_willexecutor(
|
||||
willexecutor
|
||||
):
|
||||
for wid in willexecutor["txsids"]:
|
||||
@@ -2268,7 +2267,7 @@ class BalBuildWillDialog(BalDialog):
|
||||
)
|
||||
self.bal_plugin = bal_window.bal_plugin
|
||||
w = self.bal_window.willitems[wid]
|
||||
w.set_check_willexecutor(Willexecutors.check_transaction(self.bal_plugin,w._id, w.we["url"]))
|
||||
w.set_check_willexecutor(Willexecutors.check_transaction(w._id, w.we["url"]))
|
||||
row = self.msg_edit_row(
|
||||
"checked {} - {} : {}".format(
|
||||
self.bal_window.willitems[wid].we["url"],
|
||||
@@ -3615,7 +3614,7 @@ class WillExecutorWidget(QWidget, MessageBoxMixin):
|
||||
self.willexecutor_list.update()
|
||||
|
||||
def download_list(self):
|
||||
self.willexecutors_list.update(Willexecutors.download_list(self.bal_plugin,self.bal_window.willexecutors))
|
||||
self.willexecutors_list.update(Willexecutors.download_list(self.bal_window.willexecutors))
|
||||
self.willexecutor_list.update()
|
||||
|
||||
def export_file(self, path):
|
||||
|
||||
@@ -125,14 +125,14 @@ class Willexecutors:
|
||||
# )
|
||||
|
||||
def send_request(
|
||||
bal_plugin,method, url, data=None, *, timeout=10, handle_response=None, count_reply=0
|
||||
method, url, data=None, *, timeout=10, handle_response=None, count_reply=0
|
||||
):
|
||||
network = Network.get_instance()
|
||||
if not network:
|
||||
raise Exception("You are offline.")
|
||||
_logger.debug(f"<-- {method} {url} {data}")
|
||||
headers = {}
|
||||
headers["user-agent"] = f"BalPlugin v:{bal_plugin.version()}"
|
||||
headers["user-agent"] = f"BalPlugin v:{BalPlugin.__version__}"
|
||||
headers["Content-Type"] = "text/plain"
|
||||
if not handle_response:
|
||||
handle_response = Willexecutors.handle_response
|
||||
@@ -162,7 +162,6 @@ class Willexecutors:
|
||||
_logger.debug(f"timeout({count_reply}) error: retry in 3 sec...")
|
||||
time.sleep(3)
|
||||
return Willexecutors.send_request(
|
||||
bal_plugin,
|
||||
method,
|
||||
url,
|
||||
data,
|
||||
@@ -200,12 +199,11 @@ class Willexecutors:
|
||||
class AlreadyPresentException(Exception):
|
||||
pass
|
||||
|
||||
def push_transactions_to_willexecutor(bal_plugin, willexecutor):
|
||||
def push_transactions_to_willexecutor(willexecutor):
|
||||
out = True
|
||||
try:
|
||||
_logger.debug(f"{willexecutor['url']}: {willexecutor['txs']}")
|
||||
if w := Willexecutors.send_request(
|
||||
bal_plugin,
|
||||
"post",
|
||||
willexecutor["url"] + "/" + chainname + "/pushtxs",
|
||||
data=willexecutor["txs"].encode("ascii"),
|
||||
@@ -226,16 +224,16 @@ class Willexecutors:
|
||||
|
||||
return out
|
||||
|
||||
def ping_servers(bal_plugin, willexecutors):
|
||||
def ping_servers(willexecutors):
|
||||
for url, we in willexecutors.items():
|
||||
Willexecutors.get_info_task(bal_plugin,url, we)
|
||||
Willexecutors.get_info_task(url, we)
|
||||
|
||||
def get_info_task(bal_plugin,url, willexecutor):
|
||||
def get_info_task(url, willexecutor):
|
||||
w = None
|
||||
try:
|
||||
_logger.info("GETINFO_WILLEXECUTOR")
|
||||
_logger.debug(url)
|
||||
w = Willexecutors.send_request(bal_plugin,"get", url + "/" + chainname + "/info")
|
||||
w = Willexecutors.send_request("get", url + "/" + chainname + "/info")
|
||||
if isinstance(w, dict):
|
||||
willexecutor["url"] = url
|
||||
willexecutor["status"] = 200
|
||||
@@ -262,10 +260,9 @@ class Willexecutors:
|
||||
|
||||
|
||||
|
||||
def download_list(bal_plugin,old_willexecutors):
|
||||
def download_list(old_willexecutors):
|
||||
try:
|
||||
willexecutors = Willexecutors.send_request(
|
||||
bal_plugin,
|
||||
"get",
|
||||
f"https://welist.bitcoin-after.life/data/{chainname}?page=0&limit=100",
|
||||
)
|
||||
@@ -283,7 +280,7 @@ class Willexecutors:
|
||||
_logger.error(f"Failed to download willexecutors list: {e}")
|
||||
return {}
|
||||
|
||||
def get_willexecutors_list_from_json(bal_plugin):
|
||||
def get_willexecutors_list_from_json():
|
||||
try:
|
||||
with open("willexecutors.json") as f:
|
||||
willexecutors = json.load(f)
|
||||
@@ -297,11 +294,10 @@ class Willexecutors:
|
||||
|
||||
return {}
|
||||
|
||||
def check_transaction(bal_plugin,txid, url):
|
||||
def check_transaction(txid, url):
|
||||
_logger.debug(f"{url}:{txid}")
|
||||
try:
|
||||
w = Willexecutors.send_request(
|
||||
bal_plugin,
|
||||
"post", url + "/searchtx", data=txid.encode("ascii")
|
||||
)
|
||||
return w
|
||||
|
||||
Reference in New Issue
Block a user