Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_basic.py
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
memory_before = self.nodes[0].getmemoryinfo() | memory_before = self.nodes[0].getmemoryinfo() | ||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11) | self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11) | ||||
mempool_txid = self.nodes[0].sendtoaddress( | mempool_txid = self.nodes[0].sendtoaddress( | ||||
self.nodes[2].getnewaddress(), 10) | self.nodes[2].getnewaddress(), 10) | ||||
memory_after = self.nodes[0].getmemoryinfo() | memory_after = self.nodes[0].getmemoryinfo() | ||||
assert(memory_before['locked']['used'] + | assert(memory_before['locked']['used'] + | ||||
64 <= memory_after['locked']['used']) | 64 <= memory_after['locked']['used']) | ||||
self.log.info("test sendtoaddress CheckBalance") | |||||
# Check that sendtoaddress fails with insufficient funds when you | |||||
# try to send more money than the wallet has | |||||
assert_equal(self.nodes[1].getbalance(), 50) | |||||
assert_raises_rpc_error(-6, "Insufficient funds", | |||||
self.nodes[1].sendtoaddress, | |||||
self.nodes[0].getnewaddress(), | |||||
50.00000001) | |||||
# # Check that sendtoaddress fails with insufficient fee when you | |||||
# # try to send more money than the wallet has | |||||
assert_equal(self.nodes[1].getbalance(), 50) | |||||
assert_raises_rpc_error(-4, "This transaction requires a transaction fee" | |||||
" of at least", | |||||
self.nodes[1].sendtoaddress, | |||||
self.nodes[0].getnewaddress(), | |||||
50.00000000) | |||||
assert_equal(self.nodes[1].getbalance(), 50) | |||||
self.nodes[1].sendtoaddress(self.nodes[1].getnewaddress(), 49.99999800) | |||||
assert self.nodes[1].getbalance() < 50 | |||||
self.log.info("test gettxout (second part)") | self.log.info("test gettxout (second part)") | ||||
# utxo spent in mempool should be visible if you exclude mempool | # utxo spent in mempool should be visible if you exclude mempool | ||||
# but invisible if you include mempool | # but invisible if you include mempool | ||||
txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, False) | txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, False) | ||||
assert_equal(txout['value'], 50) | assert_equal(txout['value'], 50) | ||||
txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, True) | txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, True) | ||||
assert txout is None | assert txout is None | ||||
# new utxo from mempool should be invisible if you exclude mempool | # new utxo from mempool should be invisible if you exclude mempool | ||||
▲ Show 20 Lines • Show All 381 Lines • Show Last 20 Lines |