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