mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
functional_tests: add basic transfer tests
This commit is contained in:
parent
ef7681b699
commit
b384309e17
3 changed files with 360 additions and 14 deletions
|
@ -9,7 +9,7 @@ import socket
|
||||||
import string
|
import string
|
||||||
|
|
||||||
USAGE = 'usage: functional_tests_rpc.py <python> <srcdir> <builddir> [<tests-to-run> | all]'
|
USAGE = 'usage: functional_tests_rpc.py <python> <srcdir> <builddir> [<tests-to-run> | all]'
|
||||||
DEFAULT_TESTS = ['daemon_info', 'blockchain', 'wallet_address', 'mining']
|
DEFAULT_TESTS = ['daemon_info', 'blockchain', 'wallet_address', 'mining', 'transfer']
|
||||||
try:
|
try:
|
||||||
python = sys.argv[1]
|
python = sys.argv[1]
|
||||||
srcdir = sys.argv[2]
|
srcdir = sys.argv[2]
|
||||||
|
|
|
@ -47,38 +47,59 @@ class Wallet(object):
|
||||||
destinations.append({'amount':transfer_amounts[i],'address':addresses[i]})
|
destinations.append({'amount':transfer_amounts[i],'address':addresses[i]})
|
||||||
return destinations
|
return destinations
|
||||||
|
|
||||||
def transfer(self, destinations, ringsize=7, payment_id=''):
|
def transfer(self, destinations, account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, unlock_time = 0, payment_id = '', get_tx_key = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
|
||||||
transfer = {
|
transfer = {
|
||||||
'method': 'transfer',
|
'method': 'transfer',
|
||||||
'params': {
|
'params': {
|
||||||
'destinations': destinations,
|
'destinations': destinations,
|
||||||
'mixin' : ringsize - 1,
|
'account_index': account_index,
|
||||||
'get_tx_key' : True
|
'subaddr_indices': subaddr_indices,
|
||||||
|
'priority': priority,
|
||||||
|
'ring_size' : ring_size,
|
||||||
|
'unlock_time' : unlock_time,
|
||||||
|
'payment_id' : payment_id,
|
||||||
|
'get_tx_key' : get_tx_key,
|
||||||
|
'do_not_relay' : do_not_relay,
|
||||||
|
'get_tx_hex' : get_tx_hex,
|
||||||
|
'get_tx_metadata' : get_tx_metadata,
|
||||||
},
|
},
|
||||||
'jsonrpc': '2.0',
|
'jsonrpc': '2.0',
|
||||||
'id': '0'
|
'id': '0'
|
||||||
}
|
}
|
||||||
if(len(payment_id) > 0):
|
|
||||||
transfer['params'].update({'payment_id' : payment_id})
|
|
||||||
return self.rpc.send_json_rpc_request(transfer)
|
return self.rpc.send_json_rpc_request(transfer)
|
||||||
|
|
||||||
def transfer_split(self, destinations, ringsize=7, payment_id=''):
|
def transfer_split(self, destinations, account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, unlock_time = 0, payment_id = '', get_tx_key = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
|
||||||
print(destinations)
|
|
||||||
transfer = {
|
transfer = {
|
||||||
"method": "transfer_split",
|
"method": "transfer_split",
|
||||||
"params": {
|
"params": {
|
||||||
"destinations": destinations,
|
'destinations': destinations,
|
||||||
"mixin" : ringsize - 1,
|
'account_index': account_index,
|
||||||
"get_tx_key" : True,
|
'subaddr_indices': subaddr_indices,
|
||||||
"new_algorithm" : True
|
'priority': priority,
|
||||||
|
'ring_size' : ring_size,
|
||||||
|
'unlock_time' : unlock_time,
|
||||||
|
'payment_id' : payment_id,
|
||||||
|
'get_tx_key' : get_tx_key,
|
||||||
|
'do_not_relay' : do_not_relay,
|
||||||
|
'get_tx_hex' : get_tx_hex,
|
||||||
|
'get_tx_metadata' : get_tx_metadata,
|
||||||
},
|
},
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": "0"
|
"id": "0"
|
||||||
}
|
}
|
||||||
if(len(payment_id) > 0):
|
|
||||||
transfer['params'].update({'payment_id' : payment_id})
|
|
||||||
return self.rpc.send_json_rpc_request(transfer)
|
return self.rpc.send_json_rpc_request(transfer)
|
||||||
|
|
||||||
|
def describe_transfer(self, unsigned_txset):
|
||||||
|
describe_transfer = {
|
||||||
|
'method': 'describe_transfer',
|
||||||
|
'params': {
|
||||||
|
'unsigned_txset': unsigned_txset,
|
||||||
|
},
|
||||||
|
'jsonrpc': '2.0',
|
||||||
|
'id': '0'
|
||||||
|
}
|
||||||
|
return self.rpc.send_json_rpc_request(describe_transfer)
|
||||||
|
|
||||||
def create_wallet(self, index=''):
|
def create_wallet(self, index=''):
|
||||||
create_wallet = {
|
create_wallet = {
|
||||||
'method': 'create_wallet',
|
'method': 'create_wallet',
|
||||||
|
@ -235,3 +256,37 @@ class Wallet(object):
|
||||||
'id': '0'
|
'id': '0'
|
||||||
}
|
}
|
||||||
return self.rpc.send_json_rpc_request(refresh)
|
return self.rpc.send_json_rpc_request(refresh)
|
||||||
|
|
||||||
|
def incoming_transfers(self, transfer_type='all', account_index = 0, subaddr_indices = []):
|
||||||
|
incoming_transfers = {
|
||||||
|
'method': 'incoming_transfers',
|
||||||
|
'params' : {
|
||||||
|
'transfer_type': transfer_type,
|
||||||
|
'account_index': account_index,
|
||||||
|
'subaddr_indices': subaddr_indices,
|
||||||
|
},
|
||||||
|
'jsonrpc': '2.0',
|
||||||
|
'id': '0'
|
||||||
|
}
|
||||||
|
return self.rpc.send_json_rpc_request(incoming_transfers)
|
||||||
|
|
||||||
|
def get_transfers(self, in_ = True, out = True, pending = True, failed = True, pool = True, min_height = None, max_height = None, account_index = 0, subaddr_indices = [], all_accounts = False):
|
||||||
|
get_transfers = {
|
||||||
|
'method': 'get_transfers',
|
||||||
|
'params' : {
|
||||||
|
'in': in_,
|
||||||
|
'out': out,
|
||||||
|
'pending': pending,
|
||||||
|
'failed': failed,
|
||||||
|
'pool': pool,
|
||||||
|
'min_height': min_height,
|
||||||
|
'max_height': max_height,
|
||||||
|
'filter_by_height': min_height or max_height,
|
||||||
|
'account_index': account_index,
|
||||||
|
'subaddr_indices': subaddr_indices,
|
||||||
|
'all_accounts': all_accounts,
|
||||||
|
},
|
||||||
|
'jsonrpc': '2.0',
|
||||||
|
'id': '0'
|
||||||
|
}
|
||||||
|
return self.rpc.send_json_rpc_request(get_transfers)
|
||||||
|
|
291
tests/functional_tests/transfer.py
Executable file
291
tests/functional_tests/transfer.py
Executable file
|
@ -0,0 +1,291 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Copyright (c) 2019 The Monero Project
|
||||||
|
#
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
# permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other
|
||||||
|
# materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software without specific
|
||||||
|
# prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
|
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
"""Test simple transfers
|
||||||
|
"""
|
||||||
|
|
||||||
|
from test_framework.daemon import Daemon
|
||||||
|
from test_framework.wallet import Wallet
|
||||||
|
|
||||||
|
class TransferTest():
|
||||||
|
def run_test(self):
|
||||||
|
self.create(0)
|
||||||
|
self.mine()
|
||||||
|
self.transfer()
|
||||||
|
|
||||||
|
def create(self, idx):
|
||||||
|
print 'Creating wallet'
|
||||||
|
wallet = Wallet()
|
||||||
|
# close the wallet if any, will throw if none is loaded
|
||||||
|
try: wallet.close_wallet()
|
||||||
|
except: pass
|
||||||
|
seeds = [
|
||||||
|
'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',
|
||||||
|
'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',
|
||||||
|
'dilute gutter certain antics pamphlet macro enjoy left slid guarded bogeys upload nineteen bomb jubilee enhanced irritate turnip eggs swung jukebox loudly reduce sedan slid',
|
||||||
|
]
|
||||||
|
res = wallet.restore_deterministic_wallet(seed = seeds[idx])
|
||||||
|
|
||||||
|
def mine(self):
|
||||||
|
print("Mining some blocks")
|
||||||
|
daemon = Daemon()
|
||||||
|
wallet = Wallet()
|
||||||
|
|
||||||
|
daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 80)
|
||||||
|
wallet.refresh()
|
||||||
|
|
||||||
|
def transfer(self):
|
||||||
|
daemon = Daemon()
|
||||||
|
wallet = Wallet()
|
||||||
|
|
||||||
|
print("Creating transfer to self")
|
||||||
|
|
||||||
|
dst = {'address': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'amount': 1000000000000}
|
||||||
|
|
||||||
|
payment_id = '1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde'
|
||||||
|
|
||||||
|
res = 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
|
||||||
|
assert len(res.tx_key) == 0
|
||||||
|
assert res.amount > 0
|
||||||
|
amount = res.amount
|
||||||
|
assert res.fee > 0
|
||||||
|
fee = res.fee
|
||||||
|
assert len(res.tx_blob) == 0
|
||||||
|
assert len(res.tx_metadata) == 0
|
||||||
|
assert len(res.multisig_txset) == 0
|
||||||
|
assert len(res.unsigned_txset) == 0
|
||||||
|
unsigned_txset = res.unsigned_txset
|
||||||
|
|
||||||
|
wallet.refresh()
|
||||||
|
|
||||||
|
res = daemon.get_info()
|
||||||
|
height = res.height
|
||||||
|
|
||||||
|
res = wallet.get_transfers()
|
||||||
|
assert len(res['in']) == height - 1 # coinbases
|
||||||
|
assert not 'out' in res or len(res.out) == 0 # not mined yet
|
||||||
|
assert len(res.pending) == 1
|
||||||
|
assert not 'pool' in res or len(res.pool) == 0
|
||||||
|
assert not 'failed' in res or len(res.failed) == 0
|
||||||
|
for e in res['in']:
|
||||||
|
assert e.type == 'block'
|
||||||
|
e = res.pending[0]
|
||||||
|
assert e.txid == txid
|
||||||
|
assert e.payment_id == payment_id
|
||||||
|
assert e.type == 'pending'
|
||||||
|
assert e.unlock_time == 0
|
||||||
|
assert e.subaddr_index.major == 0
|
||||||
|
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
||||||
|
assert e.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'
|
||||||
|
assert e.double_spend_seen == False
|
||||||
|
assert e.confirmations == 0
|
||||||
|
|
||||||
|
daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1)
|
||||||
|
wallet.refresh()
|
||||||
|
|
||||||
|
res = wallet.get_transfers()
|
||||||
|
assert len(res['in']) == height # coinbases
|
||||||
|
assert len(res.out) == 1 # not mined yet
|
||||||
|
assert not 'pending' in res or len(res.pending) == 0
|
||||||
|
assert not 'pool' in res or len(res.pool) == 0
|
||||||
|
assert not 'failed' in res or len(res.failed) == 0
|
||||||
|
for e in res['in']:
|
||||||
|
assert e.type == 'block'
|
||||||
|
e = res.out[0]
|
||||||
|
assert e.txid == txid
|
||||||
|
assert e.payment_id == payment_id
|
||||||
|
assert e.type == 'out'
|
||||||
|
assert e.unlock_time == 0
|
||||||
|
assert e.subaddr_index.major == 0
|
||||||
|
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
||||||
|
assert e.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'
|
||||||
|
assert e.double_spend_seen == False
|
||||||
|
assert e.confirmations == 1
|
||||||
|
|
||||||
|
print("Creating transfer to another")
|
||||||
|
|
||||||
|
dst = {'address': '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW', 'amount': 1000000000000}
|
||||||
|
res = wallet.transfer([dst], ring_size = 11, payment_id = payment_id, get_tx_key = True)
|
||||||
|
assert len(res.tx_hash) == 32*2
|
||||||
|
txid = res.tx_hash
|
||||||
|
assert len(res.tx_key) == 32*2
|
||||||
|
assert res.amount == 1000000000000
|
||||||
|
amount = res.amount
|
||||||
|
assert res.fee > 0
|
||||||
|
fee = res.fee
|
||||||
|
assert len(res.tx_blob) == 0
|
||||||
|
assert len(res.tx_metadata) == 0
|
||||||
|
assert len(res.multisig_txset) == 0
|
||||||
|
assert len(res.unsigned_txset) == 0
|
||||||
|
unsigned_txset = res.unsigned_txset
|
||||||
|
|
||||||
|
self.create(1)
|
||||||
|
wallet.refresh()
|
||||||
|
|
||||||
|
res = wallet.get_transfers()
|
||||||
|
assert not 'in' in res or len(res['in']) == 0
|
||||||
|
assert not 'out' in res or len(res.out) == 0
|
||||||
|
assert not 'pending' in res or len(res.pending) == 0
|
||||||
|
assert len(res.pool) == 1
|
||||||
|
assert not 'failed' in res or len(res.failed) == 0
|
||||||
|
e = res.pool[0]
|
||||||
|
assert e.txid == txid
|
||||||
|
assert e.payment_id == payment_id
|
||||||
|
assert e.type == 'pool'
|
||||||
|
assert e.unlock_time == 0
|
||||||
|
assert e.subaddr_index.major == 0
|
||||||
|
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
||||||
|
assert e.address == '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW'
|
||||||
|
assert e.double_spend_seen == False
|
||||||
|
assert e.confirmations == 0
|
||||||
|
assert e.amount == amount
|
||||||
|
assert e.fee == fee
|
||||||
|
|
||||||
|
daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1)
|
||||||
|
wallet.refresh()
|
||||||
|
|
||||||
|
res = wallet.get_transfers()
|
||||||
|
assert len(res['in']) == 1
|
||||||
|
assert not 'out' in res or len(res.out) == 0
|
||||||
|
assert not 'pending' in res or len(res.pending) == 0
|
||||||
|
assert not 'pool' in res or len(res.pool) == 0
|
||||||
|
assert not 'failed' in res or len(res.failed) == 0
|
||||||
|
e = res['in'][0]
|
||||||
|
assert e.txid == txid
|
||||||
|
assert e.payment_id == payment_id
|
||||||
|
assert e.type == 'in'
|
||||||
|
assert e.unlock_time == 0
|
||||||
|
assert e.subaddr_index.major == 0
|
||||||
|
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
||||||
|
assert e.address == '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW'
|
||||||
|
assert e.double_spend_seen == False
|
||||||
|
assert e.confirmations == 1
|
||||||
|
assert e.amount == amount
|
||||||
|
assert e.fee == fee
|
||||||
|
|
||||||
|
print 'Creating multi out transfer'
|
||||||
|
|
||||||
|
self.create(0)
|
||||||
|
wallet.refresh()
|
||||||
|
|
||||||
|
dst0 = {'address': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'amount': 1000000000000}
|
||||||
|
dst1 = {'address': '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW', 'amount': 1100000000000}
|
||||||
|
dst2 = {'address': '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK', 'amount': 1200000000000}
|
||||||
|
res = wallet.transfer([dst0, dst1, dst2], ring_size = 11, payment_id = payment_id, get_tx_key = True)
|
||||||
|
assert len(res.tx_hash) == 32*2
|
||||||
|
txid = res.tx_hash
|
||||||
|
assert len(res.tx_key) == 32*2
|
||||||
|
assert res.amount == 1000000000000 + 1100000000000 + 1200000000000
|
||||||
|
amount = res.amount
|
||||||
|
assert res.fee > 0
|
||||||
|
fee = res.fee
|
||||||
|
assert len(res.tx_blob) == 0
|
||||||
|
assert len(res.tx_metadata) == 0
|
||||||
|
assert len(res.multisig_txset) == 0
|
||||||
|
assert len(res.unsigned_txset) == 0
|
||||||
|
unsigned_txset = res.unsigned_txset
|
||||||
|
|
||||||
|
daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1)
|
||||||
|
wallet.refresh()
|
||||||
|
|
||||||
|
res = wallet.get_transfers()
|
||||||
|
assert len(res['in']) == height + 2
|
||||||
|
assert len(res.out) == 3
|
||||||
|
assert not 'pending' in res or len(res.pending) == 0
|
||||||
|
assert not 'pool' in res or len(res.pool) == 1
|
||||||
|
assert not 'failed' in res or len(res.failed) == 0
|
||||||
|
e = [o for o in res.out if o.txid == txid]
|
||||||
|
assert len(e) == 1
|
||||||
|
e = e[0]
|
||||||
|
assert e.txid == txid
|
||||||
|
assert e.payment_id == payment_id
|
||||||
|
assert e.type == 'out'
|
||||||
|
assert e.unlock_time == 0
|
||||||
|
assert e.subaddr_index.major == 0
|
||||||
|
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
||||||
|
assert e.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'
|
||||||
|
assert e.double_spend_seen == False
|
||||||
|
assert e.confirmations == 1
|
||||||
|
|
||||||
|
assert e.amount == amount
|
||||||
|
assert e.fee == fee
|
||||||
|
|
||||||
|
self.create(1)
|
||||||
|
wallet.refresh()
|
||||||
|
res = wallet.get_transfers()
|
||||||
|
assert len(res['in']) == 2
|
||||||
|
assert not 'out' in res or len(res.out) == 0
|
||||||
|
assert not 'pending' in res or len(res.pending) == 0
|
||||||
|
assert not 'pool' in res or len(res.pool) == 0
|
||||||
|
assert not 'failed' in res or len(res.failed) == 0
|
||||||
|
e = [o for o in res['in'] if o.txid == txid]
|
||||||
|
assert len(e) == 1
|
||||||
|
e = e[0]
|
||||||
|
assert e.txid == txid
|
||||||
|
assert e.payment_id == payment_id
|
||||||
|
assert e.type == 'in'
|
||||||
|
assert e.unlock_time == 0
|
||||||
|
assert e.subaddr_index.major == 0
|
||||||
|
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
||||||
|
assert e.address == '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW'
|
||||||
|
assert e.double_spend_seen == False
|
||||||
|
assert e.confirmations == 1
|
||||||
|
assert e.amount == 1100000000000
|
||||||
|
assert e.fee == fee
|
||||||
|
|
||||||
|
self.create(2)
|
||||||
|
wallet.refresh()
|
||||||
|
res = wallet.get_transfers()
|
||||||
|
assert len(res['in']) == 1
|
||||||
|
assert not 'out' in res or len(res.out) == 0
|
||||||
|
assert not 'pending' in res or len(res.pending) == 0
|
||||||
|
assert not 'pool' in res or len(res.pool) == 0
|
||||||
|
assert not 'failed' in res or len(res.failed) == 0
|
||||||
|
e = [o for o in res['in'] if o.txid == txid]
|
||||||
|
assert len(e) == 1
|
||||||
|
e = e[0]
|
||||||
|
assert e.txid == txid
|
||||||
|
assert e.payment_id == payment_id
|
||||||
|
assert e.type == 'in'
|
||||||
|
assert e.unlock_time == 0
|
||||||
|
assert e.subaddr_index.major == 0
|
||||||
|
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
||||||
|
assert e.address == '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK'
|
||||||
|
assert e.double_spend_seen == False
|
||||||
|
assert e.confirmations == 1
|
||||||
|
assert e.amount == 1200000000000
|
||||||
|
assert e.fee == fee
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
TransferTest().run_test()
|
Loading…
Reference in a new issue