diff --git a/silkaj/blocks.py b/silkaj/blocks.py index 33e24ba2539ba90b47f4e60e0055afe6f407f2a1..6f807656170656fba88c5d5b4a9c83ff04fa8613 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 754d81be0f98b00b139a34c6827e8bd851a71f66..ba040780a07b4c4bb184b206ef2014e81d953fd5 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: {}".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 e47db1a4d4ec15263eeef6fd26e01665c3f68eb3..3b3a81a0e7bd230639692a263655c19711799343 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(f"{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 {} blocks from n°{} to n°{}".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 a27f904dcca47b654d0aabec0d884fdd947ce91d..93a901e996a755e4718facdd5d0b7a48456d5795 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: {}".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 666f142459c1eb570ce67f35ab30eda5a386f6f7..b53fd7ab80e89f8240c4d4e53445040dff77045b 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 1e3bc2ffa6ac87069e6ddabfb222d1685863abf0..727e81e537c41a177e28eecf320222b88c1854f4 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 1b4591832965c42727007f87fcf096ca4a4a79ad..f0807e2f621386c0336f21cc87d1ded9695f9bc0 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 ee4d15b9974ab799df17e8a3b857b84df05f7831..d83d603dd3bda72c072ff4b98c9707ce01daecb6 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"]: