diff --git a/silkaj/blocks.py b/silkaj/blocks.py index 236d914fc9384260d72995e8319c977ae8e3e40f..e6c8fff098e5212aa562f6ebefbb2de0c41fbc2e 100644 --- a/silkaj/blocks.py +++ b/silkaj/blocks.py @@ -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 diff --git a/silkaj/cert.py b/silkaj/cert.py index 1d967848a72f0c780c7bc5a46fa850a4dd3d0649..5c16746629f6facb578a8972551945cd8143a7c3 100644 --- a/silkaj/cert.py +++ b/silkaj/cert.py @@ -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 diff --git a/silkaj/commands.py b/silkaj/commands.py index b83608a2bc19e59f97da76fdf417d797524b422c..16fec63e5a38a94ee5f3b7996cc2abf38eba5b9d 100644 --- a/silkaj/commands.py +++ b/silkaj/commands.py @@ -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() diff --git a/silkaj/membership.py b/silkaj/membership.py index 453628c26b3caf6ee9729cf1a1278ed3c95b661b..e62302ec042f860c6b4345f3ca0a404725096efb 100644 --- a/silkaj/membership.py +++ b/silkaj/membership.py @@ -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): diff --git a/silkaj/money.py b/silkaj/money.py index e9007b475680434c392d3a7d5ba4f1439ecf709f..6e3dcfb700e845ef801d36ffea9884da63ebd96b 100644 --- a/silkaj/money.py +++ b/silkaj/money.py @@ -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): diff --git a/silkaj/tui.py b/silkaj/tui.py index b98bdc9b652d92478a5863dbbb681a2eea11432a..985c97455fb79ab97714099e7ce8e02e8fa06b6b 100644 --- a/silkaj/tui.py +++ b/silkaj/tui.py @@ -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) diff --git a/silkaj/tx.py b/silkaj/tx.py index 6ba18b4608a687b7ebd03b76797ca45a590a18e8..466d3fb1475065e4a52baf9167faacf59cfac066 100644 --- a/silkaj/tx.py +++ b/silkaj/tx.py @@ -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 diff --git a/silkaj/tx_history.py b/silkaj/tx_history.py index e9ae0d6e7812b719e6532f2e4bec83bbcb8efd69..da9742182a7de0d66a44379e9e64eb8c1bdf4705 100644 --- a/silkaj/tx_history.py +++ b/silkaj/tx_history.py @@ -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()) diff --git a/silkaj/wot.py b/silkaj/wot.py index eb96533d216af3f32919042dddb51bf3b3101693..5fbfb80de30fd1a0629765ffcd932b8eba135878 100644 --- a/silkaj/wot.py +++ b/silkaj/wot.py @@ -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"]: