Skip to content
Snippets Groups Projects
Commit 7dd5bc92 authored by Moul's avatar Moul
Browse files

[mod] #396: Remove client.close() now in DuniterPy

parent 7fb04077
No related branches found
No related tags found
No related merge requests found
......@@ -54,7 +54,6 @@ def verify_blocks_signatures(from_block, to_block):
block = Block.from_signed_raw(block["raw"] + block["signature"] + "\n")
verify_block_signature(invalid_blocks_signatures, block)
client.close()
display_result(from_block, to_block, invalid_blocks_signatures)
......@@ -63,13 +62,11 @@ def check_passed_blocks_range(client, from_block, to_block):
if to_block == 0:
to_block = head_number
if to_block > head_number:
client.close()
message_exit(
"Passed TO_BLOCK argument is bigger than the head block: "
+ str(head_number)
)
if from_block > to_block:
client.close()
message_exit("TO_BLOCK should be bigger or equal to FROM_BLOCK")
return to_block
......
......@@ -85,8 +85,6 @@ def send_certification(ctx, uid_pubkey_to_certify):
else:
print("Error while publishing certification: {0}".format(response.text()))
client.close()
def pre_checks(client, issuer_pubkey, pubkey_to_certify):
# Check whether current user is member
......
......@@ -56,8 +56,6 @@ def currency_info():
"\nDifference time:",
current_time.diff_for_humans(mediantime, True),
)
client = ClientInstance().client
client.close()
def match_pattern(pow, match="", p=1):
......@@ -93,7 +91,6 @@ def difficulties():
jsonschema.validate(current, bma.ws.WS_BLOCK_SCHEMA)
diffi = client(bma.blockchain.difficulties)
display_diffi(current, diffi)
client.close()
except jsonschema.ValidationError as e:
print("{:}:{:}".format(str(e.__class__.__name__), str(e)))
......@@ -169,7 +166,6 @@ def list_blocks(number, detailed):
):
issuer2["uid"] = idty["uid"]
issuer2.pop("pubkey")
client.close()
print(
"Last {0} blocks from n°{1} to n°{2}".format(
number, current_nbr - number + 1, current_nbr
......@@ -249,5 +245,3 @@ def argos_info():
"\nDifference time:",
current_time.diff_for_humans(mediantime, True),
)
client = ClientInstance().client
client.close()
......@@ -74,7 +74,6 @@ def send_membership(ctx):
if dry_run:
click.echo(membership.signed_raw())
client.close()
sys.exit(SUCCESS_EXIT_STATUS)
if ctx.obj["DISPLAY_DOCUMENT"]:
......@@ -89,7 +88,6 @@ def send_membership(ctx):
else:
print("Error while publishing membership: {0}".format(response.text()))
logging.debug(response.text())
client.close()
def display_confirmation_table(identity_uid, pubkey, identity_timestamp):
......
......@@ -35,7 +35,6 @@ from silkaj.tui import display_amount, display_pubkey_and_checksum
@argument("pubkeys", nargs=-1)
@pass_context
def cmd_amount(ctx, pubkeys):
client = ClientInstance().client
if not has_auth_method():
# check input pubkeys
......@@ -68,7 +67,6 @@ def cmd_amount(ctx, pubkeys):
key = auth_method()
pubkey = key.pubkey
show_amount_from_pubkey(pubkey, get_amount_from_pubkey(pubkey))
client.close()
def show_amount_from_pubkey(label, inputs_balance):
......
......@@ -20,7 +20,7 @@ import click
from silkaj import constants
from silkaj import crypto_tools as ct
from silkaj import network_tools, wot_tools
from silkaj import wot_tools
def display_amount(tx, message, amount, ud_value, currency_symbol):
......@@ -64,6 +64,4 @@ def display_pubkey_and_checksum(
def send_doc_confirmation(document_name):
if not click.confirm(f"Do you confirm sending this {document_name}?"):
client = network_tools.ClientInstance().client
client.close()
sys.exit(constants.SUCCESS_EXIT_STATUS)
......@@ -167,9 +167,6 @@ def send_transaction(
comment,
outputbackchange,
)
else:
client = nt.ClientInstance().client
client.close()
def transaction_amount(amounts, UDs_amounts, outputAddresses):
......@@ -332,8 +329,6 @@ def handle_intermediaries_transactions(
Comment="",
OutputbackChange=None,
):
client = nt.ClientInstance().client
while True:
# consider there is always one backchange output, hence +1
listinput_and_amount = get_list_input_for_transaction(
......@@ -361,7 +356,6 @@ def handle_intermediaries_transactions(
Comment,
OutputbackChange,
)
client.close()
break
......
......@@ -53,7 +53,6 @@ def transaction_history(pubkey, uids, full_pubkey):
)
table = Texttable(max_width=shutil.get_terminal_size().columns)
table.add_rows(txs_list)
client.close()
echo_via_pager(header + table.draw())
......
......@@ -102,7 +102,6 @@ def received_sent_certifications(uid_pubkey):
)
)
membership_status(certifications, pubkey, req)
client.close()
def cert_written_in_the_blockchain(written_certs, certifieur):
......@@ -156,10 +155,7 @@ def id_pubkey_correspondence(uid_pubkey):
if checked_pubkey:
uid_pubkey = checked_pubkey
client = ClientInstance().client
lookups = wt.wot_lookup(uid_pubkey)
await client.close()
content = f"Public keys or user id found matching '{uid_pubkey}':\n"
for lookup in lookups:
for identity in lookup["uids"]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment