From b3a32d55052f0e2483f1abb08aed0aed1a52cbb5 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 24 Mar 2019 08:58:27 +0000 Subject: functional_tests: add describe_transfer tests --- utils/python-rpc/framework/wallet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'utils/python-rpc/framework/wallet.py') diff --git a/utils/python-rpc/framework/wallet.py b/utils/python-rpc/framework/wallet.py index ea683b8c5..5b0df2e13 100644 --- a/utils/python-rpc/framework/wallet.py +++ b/utils/python-rpc/framework/wallet.py @@ -101,11 +101,12 @@ class Wallet(object): } return self.rpc.send_json_rpc_request(get_bulk_payments) - def describe_transfer(self, unsigned_txset): + def describe_transfer(self, unsigned_txset = '', multisig_txset = ''): describe_transfer = { 'method': 'describe_transfer', 'params': { 'unsigned_txset': unsigned_txset, + 'multisig_txset': multisig_txset, }, 'jsonrpc': '2.0', 'id': '0' -- cgit v1.2.3 From 2d68b31f3e58767c961a790dd51811d69798eac0 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 25 Mar 2019 10:59:46 +0000 Subject: functional_tests: add more wallet tests get_transfer_by_txid, get_height, open/close --- tests/functional_tests/transfer.py | 26 ++++++++++++++++++++++++++ tests/functional_tests/wallet_address.py | 29 +++++++++++++++++++++++++++++ utils/python-rpc/framework/wallet.py | 31 +++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) (limited to 'utils/python-rpc/framework/wallet.py') diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py index b7a85f1d6..d0c692157 100755 --- a/tests/functional_tests/transfer.py +++ b/tests/functional_tests/transfer.py @@ -62,9 +62,14 @@ class TransferTest(): print("Mining some blocks") daemon = Daemon() + res = daemon.get_info() + height = res.height + daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 80) for i in range(len(self.wallet)): self.wallet[i].refresh() + res = self.wallet[i].get_height() + assert res.height == height + 80 def transfer(self): daemon = Daemon() @@ -169,6 +174,27 @@ class TransferTest(): assert e.double_spend_seen == False assert e.confirmations == 1 + res = self.wallet[0].get_height() + wallet_height = res.height + res = self.wallet[0].get_transfer_by_txid(txid) + assert len(res.transfers) == 1 + assert res.transfers[0] == res.transfer + t = res.transfer + assert t.txid == txid + assert t.payment_id == payment_id + assert t.height == wallet_height - 1 + assert t.timestamp > 0 + assert t.amount == 0 # to self, so it's just "pay a fee" really + assert t.fee == fee + assert t.note == '' + assert len(t.destinations) == 1 + assert t.destinations[0] == {'address': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'amount': 1000000000000} + assert t.type == 'out' + assert t.unlock_time == 0 + assert t.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm' + assert t.double_spend_seen == False + assert t.confirmations == 1 + res = self.wallet[0].get_balance() assert res.balance == running_balances[0] assert res.unlocked_balance <= res.balance diff --git a/tests/functional_tests/wallet_address.py b/tests/functional_tests/wallet_address.py index 66a1633ca..4b2010019 100755 --- a/tests/functional_tests/wallet_address.py +++ b/tests/functional_tests/wallet_address.py @@ -45,6 +45,7 @@ class WalletAddressTest(): self.check_main_address() self.check_keys() self.create_subaddresses() + self.open_close() def create(self): print 'Creating wallet' @@ -148,5 +149,33 @@ class WalletAddressTest(): res = wallet.get_address_index('82pP87g1Vkd3LUMssBCumk3MfyEsFqLAaGDf6oxddu61EgSFzt8gCwUD4tr3kp9TUfdPs2CnpD7xLZzyC1Ei9UsW3oyCWDf') assert res.index == {'major': 1, 'minor': 0} + def open_close(self): + print 'Testing open/close' + wallet = Wallet() + + res = wallet.get_address() + assert res.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm' + + wallet.close_wallet() + ok = False + try: res = wallet.get_address() + except: ok = True + assert ok + + wallet.restore_deterministic_wallet(seed = 'peeled mixture ionic radar utopia puddle buying illness nuns gadget river spout cavernous bounced paradise drunk looking cottage jump tequila melting went winter adjust spout') + res = wallet.get_address() + assert res.address == '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW' + + wallet.close_wallet() + ok = False + try: wallet.get_address() + except: ok = True + assert ok + + wallet.restore_deterministic_wallet(seed = 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted') + res = wallet.get_address() + assert res.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm' + + if __name__ == '__main__': WalletAddressTest().run_test() diff --git a/utils/python-rpc/framework/wallet.py b/utils/python-rpc/framework/wallet.py index 5b0df2e13..e09778c80 100644 --- a/utils/python-rpc/framework/wallet.py +++ b/utils/python-rpc/framework/wallet.py @@ -89,6 +89,18 @@ class Wallet(object): } return self.rpc.send_json_rpc_request(transfer) + def get_transfer_by_txid(self, txid, account_index = 0): + get_transfer_by_txid = { + 'method': 'get_transfer_by_txid', + 'params': { + 'txid': txid, + 'account_index': account_index, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(get_transfer_by_txid) + def get_bulk_payments(self, payment_ids = [], min_block_height = 0): get_bulk_payments = { 'method': 'get_bulk_payments', @@ -592,6 +604,25 @@ class Wallet(object): } return self.rpc.send_json_rpc_request(verify) + def get_height(self): + get_height = { + 'method': 'get_height', + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(get_height) + + def relay_tx(self, hex_): + relay_tx = { + 'method': 'relay_tx', + 'params': { + 'hex': hex_, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(relay_tx) + def get_version(self): get_version = { 'method': 'get_version', -- cgit v1.2.3 From f8be31d2697e71d60c5a4bddc4f39aa58a506a0d Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 25 Mar 2019 13:02:50 +0000 Subject: functional_tests: add wallet creation language tests --- tests/functional_tests/wallet_address.py | 21 +++++++++++++++++++++ utils/python-rpc/framework/wallet.py | 18 ++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) (limited to 'utils/python-rpc/framework/wallet.py') diff --git a/tests/functional_tests/wallet_address.py b/tests/functional_tests/wallet_address.py index 4b2010019..cb9c52e7a 100755 --- a/tests/functional_tests/wallet_address.py +++ b/tests/functional_tests/wallet_address.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +#encoding=utf-8 # Copyright (c) 2019 The Monero Project # @@ -46,6 +47,7 @@ class WalletAddressTest(): self.check_keys() self.create_subaddresses() self.open_close() + self.languages() def create(self): print 'Creating wallet' @@ -176,6 +178,25 @@ class WalletAddressTest(): res = wallet.get_address() assert res.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm' + def languages(self): + print('Testing languages') + wallet = Wallet() + res = wallet.get_languages() + assert 'English' in res.languages + assert 'English' in res.languages_local + assert 'Dutch' in res.languages + assert 'Nederlands' in res.languages_local + assert 'Japanese' in res.languages + assert u'日本語' in res.languages_local + try: wallet.close_wallet() + except: pass + languages = res.languages + for language in languages: + print 'Creating ' + str(language) + ' wallet' + wallet.create_wallet(filename = '', language = language) + res = wallet.query_key('mnemonic') + wallet.close_wallet() + if __name__ == '__main__': WalletAddressTest().run_test() diff --git a/utils/python-rpc/framework/wallet.py b/utils/python-rpc/framework/wallet.py index e09778c80..bcf908291 100644 --- a/utils/python-rpc/framework/wallet.py +++ b/utils/python-rpc/framework/wallet.py @@ -125,13 +125,13 @@ class Wallet(object): } return self.rpc.send_json_rpc_request(describe_transfer) - def create_wallet(self, index=''): + def create_wallet(self, filename='', password = '', language = 'English'): create_wallet = { 'method': 'create_wallet', 'params': { - 'filename': 'testWallet' + index, - 'password' : '', - 'language' : 'English' + 'filename': filename, + 'password': password, + 'language': language }, 'jsonrpc': '2.0', 'id': '0' @@ -623,6 +623,16 @@ class Wallet(object): } return self.rpc.send_json_rpc_request(relay_tx) + def get_languages(self): + get_languages = { + 'method': 'get_languages', + 'params': { + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(get_languages) + def get_version(self): get_version = { 'method': 'get_version', -- cgit v1.2.3 From 798e3cad2ba923d61cbce95784ee7990bf20b3a0 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 25 Mar 2019 20:49:09 +0000 Subject: functional_tests: add double spend detection tests --- tests/functional_tests/transfer.py | 61 ++++++++++++++++++++++++++++++++++++ utils/python-rpc/framework/wallet.py | 16 ++++++++-- 2 files changed, 75 insertions(+), 2 deletions(-) (limited to 'utils/python-rpc/framework/wallet.py') diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py index d0c692157..050277c51 100755 --- a/tests/functional_tests/transfer.py +++ b/tests/functional_tests/transfer.py @@ -42,6 +42,7 @@ class TransferTest(): self.mine() self.transfer() self.check_get_bulk_payments() + self.check_double_spend_detection() def create(self): print 'Creating wallets' @@ -509,5 +510,65 @@ class TransferTest(): res = self.wallet[2].get_bulk_payments(payment_ids = ['1'*64, '1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde', '2'*64]) assert len(res.payments) >= 1 # one tx was sent + def check_double_spend_detection(self): + print('Checking double spend detection') + txes = [[None, None], [None, None]] + for i in range(2): + self.wallet[0].restore_deterministic_wallet(seed = 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted') + self.wallet[0].refresh() + res = self.wallet[0].get_balance() + unlocked_balance = res.unlocked_balance + res = self.wallet[0].sweep_all(address = '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW', do_not_relay = True, get_tx_hex = True) + assert len(res.tx_hash_list) == 1 + assert len(res.tx_hash_list[0]) == 32*2 + txes[i][0] = res.tx_hash_list[0] + assert len(res.fee_list) == 1 + assert res.fee_list[0] > 0 + assert len(res.amount_list) == 1 + assert res.amount_list[0] == unlocked_balance - res.fee_list[0] + assert len(res.tx_blob_list) > 0 + assert len(res.tx_blob_list[0]) > 0 + assert not 'tx_metadata_list' in res or len(res.tx_metadata_list) == 0 + assert not 'multisig_txset' in res or len(res.multisig_txset) == 0 + assert not 'unsigned_txset' in res or len(res.unsigned_txset) == 0 + assert len(res.tx_blob_list) == 1 + txes[i][1] = res.tx_blob_list[0] + + daemon = Daemon() + res = daemon.send_raw_transaction(txes[0][1]) + assert res.not_relayed == False + assert res.low_mixin == False + assert res.double_spend == False + assert res.invalid_input == False + assert res.invalid_output == False + assert res.too_big == False + assert res.overspend == False + assert res.fee_too_low == False + assert res.not_rct == False + + res = daemon.get_transactions([txes[0][0]]) + assert len(res.txs) >= 1 + tx = [tx for tx in res.txs if tx.tx_hash == txes[0][0]][0] + assert tx.in_pool + assert not tx.double_spend_seen + + res = daemon.send_raw_transaction(txes[1][1]) + assert res.not_relayed == False + assert res.low_mixin == False + assert res.double_spend == True + assert res.invalid_input == False + assert res.invalid_output == False + assert res.too_big == False + assert res.overspend == False + assert res.fee_too_low == False + assert res.not_rct == False + + res = daemon.get_transactions([txes[0][0]]) + assert len(res.txs) >= 1 + tx = [tx for tx in res.txs if tx.tx_hash == txes[0][0]][0] + assert tx.in_pool + assert tx.double_spend_seen + + if __name__ == '__main__': TransferTest().run_test() diff --git a/utils/python-rpc/framework/wallet.py b/utils/python-rpc/framework/wallet.py index bcf908291..068c87493 100644 --- a/utils/python-rpc/framework/wallet.py +++ b/utils/python-rpc/framework/wallet.py @@ -159,11 +159,23 @@ class Wallet(object): } return self.rpc.send_json_rpc_request(sweep_dust) - def sweep_all(self, address): + def sweep_all(self, address = '', account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, outputs = 1, unlock_time = 0, payment_id = '', get_tx_keys = False, below_amount = 0, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False): sweep_all = { 'method': 'sweep_all', 'params' : { - 'address' : '' + 'address' : address, + 'account_index' : account_index, + 'subaddr_indices' : subaddr_indices, + 'priority' : priority, + 'ring_size' : ring_size, + 'outputs' : outputs, + 'unlock_time' : unlock_time, + 'payment_id' : payment_id, + 'get_tx_keys' : get_tx_keys, + 'below_amount' : below_amount, + 'do_not_relay' : do_not_relay, + 'get_tx_hex' : get_tx_hex, + 'get_tx_metadata' : get_tx_metadata, }, 'jsonrpc': '2.0', 'id': '0' -- cgit v1.2.3 From 04a20cb24208eb2ab2d90727b524d31bab5f9ddb Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 25 Mar 2019 23:24:30 +0000 Subject: functional_tests: cold signing key images/outputs import/export --- tests/functional_tests/cold_signing.py | 6 +++++ utils/python-rpc/framework/wallet.py | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'utils/python-rpc/framework/wallet.py') diff --git a/tests/functional_tests/cold_signing.py b/tests/functional_tests/cold_signing.py index 07edae854..e5430f87c 100755 --- a/tests/functional_tests/cold_signing.py +++ b/tests/functional_tests/cold_signing.py @@ -89,6 +89,12 @@ class ColdSigningTest(): dst = {'address': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'amount': 1000000000000} payment_id = '1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde' + self.hot_wallet.refresh() + res = self.hot_wallet.export_outputs() + self.cold_wallet.import_outputs(res.outputs_data_hex) + res = self.cold_wallet.export_key_images(True) + self.hot_wallet.import_key_images(res.signed_key_images, offset = res.offset) + res = self.hot_wallet.transfer([dst], ring_size = 11, payment_id = payment_id, get_tx_key = False) assert len(res.tx_hash) == 32*2 txid = res.tx_hash diff --git a/utils/python-rpc/framework/wallet.py b/utils/python-rpc/framework/wallet.py index 068c87493..fd104da5f 100644 --- a/utils/python-rpc/framework/wallet.py +++ b/utils/python-rpc/framework/wallet.py @@ -645,6 +645,50 @@ class Wallet(object): } return self.rpc.send_json_rpc_request(get_languages) + def export_outputs(self): + export_outputs = { + 'method': 'export_outputs', + 'params': { + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(export_outputs) + + def import_outputs(self, outputs_data_hex): + import_outputs = { + 'method': 'import_outputs', + 'params': { + 'outputs_data_hex': outputs_data_hex + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(import_outputs) + + def export_key_images(self, all_ = False): + export_key_images = { + 'method': 'export_key_images', + 'params': { + 'all': all_ + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(export_key_images) + + def import_key_images(self, signed_key_images, offset = 0): + import_key_images = { + 'method': 'import_key_images', + 'params': { + 'offset': offset, + 'signed_key_images': signed_key_images, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(import_key_images) + def get_version(self): get_version = { 'method': 'get_version', -- cgit v1.2.3 From 047af5c3430c90f93b7d00bcd86b189115b7f685 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 6 Apr 2019 11:34:59 +0000 Subject: console.py: can now connect to several daemons/wallets Also throw exceptions instead of print+exit, since that makes the error print last, below the python stack trace, where it's much less easy to miss it. --- utils/python-rpc/console.py | 118 +++++++++++++++++++---------------- utils/python-rpc/framework/daemon.py | 2 + utils/python-rpc/framework/wallet.py | 2 + 3 files changed, 69 insertions(+), 53 deletions(-) (limited to 'utils/python-rpc/framework/wallet.py') diff --git a/utils/python-rpc/console.py b/utils/python-rpc/console.py index 1d831c711..57a04528b 100755 --- a/utils/python-rpc/console.py +++ b/utils/python-rpc/console.py @@ -5,63 +5,62 @@ import sys import subprocess import socket import urlparse -from framework import rpc -from framework import wallet -from framework import daemon +import framework.rpc +import framework.daemon +import framework.wallet -scheme='http' -host='127.0.0.1' -port=None - -USAGE = 'usage: python -i console.py [[scheme]:]' -try: +USAGE = 'usage: python -i console.py [[[scheme]:] [[[scheme]:]...]]' +daemons = [] +wallets = [] +rpcs = [] +for n in range(1, len(sys.argv)): + scheme='http' + host='127.0.0.1' + port=None try: - port = int(sys.argv[1]) - except: - t = urlparse.urlparse(sys.argv[1], allow_fragments = False) - scheme = t.scheme or scheme - host = t.hostname or host - port = t.port or port - if scheme != 'http' and scheme != 'https': - print(USAGE) - sys.exit(1) - if port <= 0 or port > 65535: - print(USAGE) - sys.exit(1) -except Exception, e: - print('Error: ' + str(e)) - print(USAGE) - sys.exit(1) + try: + port = int(sys.argv[n]) + except: + t = urlparse.urlparse(sys.argv[n], allow_fragments = False) + scheme = t.scheme or scheme + host = t.hostname or host + port = t.port or port + if scheme != 'http' and scheme != 'https': + raise Exception(USAGE) + if port <= 0 or port > 65535: + raise Exception(USAGE) + except Exception, e: + print('Error: ' + str(e)) + raise Exception(USAGE) -# check for open port -s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -s.settimeout(1) -if s.connect_ex((host, port)) != 0: - print('No wallet or daemon RPC on port ' + str(port)) - sys.exit(1) -s.close() + # check for open port + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.settimeout(1) + if s.connect_ex((host, port)) != 0: + raise Exception('No wallet or daemon RPC on port ' + str(port)) + s.close() -# both wallet and daemon have a get_version JSON RPC -rpc = rpc.JSONRPC('{protocol}://{host}:{port}'.format(protocol=scheme, host=host, port=port)) -get_version = { - 'method': 'get_version', - 'jsonrpc': '2.0', - 'id': '0' -} -try: - res = rpc.send_json_rpc_request(get_version) -except Exception, e: - print('Failed to call version RPC: ' + str(e)) - sys.exit(1) + # both wallet and daemon have a get_version JSON RPC + rpc = framework.rpc.JSONRPC('{protocol}://{host}:{port}'.format(protocol=scheme, host=host, port=port)) + get_version = { + 'method': 'get_version', + 'jsonrpc': '2.0', + 'id': '0' + } + try: + res = rpc.send_json_rpc_request(get_version) + except Exception, e: + raise Exception('Failed to call version RPC: ' + str(e)) -if 'version' not in res: - print('Server is not a monero process') - sys.exit(1) + if 'version' not in res: + raise Exception('Server is not a Monero process') -if 'status' in res: - rpc = daemon.Daemon(port=port) -else: - rpc = wallet.Wallet(port=port) + if 'status' in res: + daemons.append(framework.daemon.Daemon(port=port)) + rpcs.append(daemons[-1]) + else: + wallets.append(framework.wallet.Wallet(port=port)) + rpcs.append(wallets[-1]) # add tab completion if we can: https://stackoverflow.com/questions/246725 try: @@ -72,5 +71,18 @@ else: import rlcompleter readline.parse_and_bind('tab: complete') -print('Connected to %s RPC on port %u' % ('daemon' if 'status' in res else 'wallet', port)) -print('The \'rpc\' object may now be used to use the API') +if len(daemons) == 1: + daemon = daemons[0] +if len(wallets) == 1: + wallet = wallets[0] + +didx = 0 +widx = 0 +for rpc in rpcs: + if type(rpc) == framework.daemon.Daemon: + var = "daemon" if len(daemons) == 1 else "daemons[" + str(didx) + "]" + didx += 1 + else: + var = "wallet" if len(wallets) == 1 else "wallets[" + str(widx) + "]" + widx += 1 + print('Variable \'%s\' connected to %s RPC on %s:%u' % (var, 'daemon' if type(rpc) == framework.daemon.Daemon else 'wallet', rpc.host ,rpc.port)) diff --git a/utils/python-rpc/framework/daemon.py b/utils/python-rpc/framework/daemon.py index 7968ef7fd..f4d5e90f0 100644 --- a/utils/python-rpc/framework/daemon.py +++ b/utils/python-rpc/framework/daemon.py @@ -33,6 +33,8 @@ from .rpc import JSONRPC class Daemon(object): def __init__(self, protocol='http', host='127.0.0.1', port=0, idx=0): + self.host = host + self.port = port self.rpc = JSONRPC('{protocol}://{host}:{port}'.format(protocol=protocol, host=host, port=port if port else 18180+idx)) def getblocktemplate(self, address, prev_block = ""): diff --git a/utils/python-rpc/framework/wallet.py b/utils/python-rpc/framework/wallet.py index fd104da5f..a80aaefec 100644 --- a/utils/python-rpc/framework/wallet.py +++ b/utils/python-rpc/framework/wallet.py @@ -33,6 +33,8 @@ from .rpc import JSONRPC class Wallet(object): def __init__(self, protocol='http', host='127.0.0.1', port=0, idx=0): + self.host = host + self.port = port self.rpc = JSONRPC('{protocol}://{host}:{port}'.format(protocol=protocol, host=host, port=port if port else 18090+idx)) def make_uniform_destinations(self, address, transfer_amount, transfer_number_of_destinations=1): -- cgit v1.2.3