aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-08-28 15:45:11 -0800
committerMarcoFalke <falke.marco@gmail.com>2017-08-28 15:45:45 -0800
commit91e49c51f1aecc9e1d75457f4920d52a4b0a133c (patch)
tree585a4a0553bf8d816f91a89eb8257ae357361445 /test
parent60dd9cc470584960431de425e2a9ffbed0e8034a (diff)
parent6d2d2eb49389d70a5db327e133c9c90748f82d5f (diff)
downloadbitcoin-91e49c51f1aecc9e1d75457f4920d52a4b0a133c.tar.xz
Merge #10859: RPC: gettxout: Slightly improve doc and tests
6d2d2eb49 RPC: gettxout: Slightly improve doc and tests (Jorge Timón) Pull request description: Slightly related to https://github.com/bitcoin/bitcoin/pull/10822 in the sense that I felt the documentation and testing wasn't as good as it could be while writing it. Ping @sipa since we discussed this on IRC. Tree-SHA512: a0b3ffdac65245a0429e772fc2d8bcc1e829b02c70fb2af6ee0b7578cae46683f6c51a824b4d703d4dc3f99b6f03a658d6bbc818bf32981516f24124249a211d
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/functional/wallet.py b/test/functional/wallet.py
index 40225ad55d..f58b09bdb4 100755
--- a/test/functional/wallet.py
+++ b/test/functional/wallet.py
@@ -56,6 +56,15 @@ class WalletTest(BitcoinTestFramework):
assert_equal(len(self.nodes[1].listunspent()), 1)
assert_equal(len(self.nodes[2].listunspent()), 0)
+ self.log.info("test gettxout")
+ confirmed_txid, confirmed_index = utxos[0]["txid"], utxos[0]["vout"]
+ # First, outputs that are unspent both in the chain and in the
+ # mempool should appear with or without include_mempool
+ txout = self.nodes[0].gettxout(txid=confirmed_txid, n=confirmed_index, include_mempool=False)
+ assert_equal(txout['value'], 50)
+ txout = self.nodes[0].gettxout(txid=confirmed_txid, n=confirmed_index, include_mempool=True)
+ assert_equal(txout['value'], 50)
+
# Send 21 BTC from 0 to 2 using sendtoaddress call.
# Locked memory should use at least 32 bytes to sign each transaction
self.log.info("test getmemoryinfo")
@@ -65,10 +74,9 @@ class WalletTest(BitcoinTestFramework):
memory_after = self.nodes[0].getmemoryinfo()
assert(memory_before['locked']['used'] + 64 <= memory_after['locked']['used'])
- self.log.info("test gettxout")
+ self.log.info("test gettxout (second part)")
# utxo spent in mempool should be visible if you exclude mempool
# but invisible if you include mempool
- confirmed_txid, confirmed_index = utxos[0]["txid"], utxos[0]["vout"]
txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, False)
assert_equal(txout['value'], 50)
txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, True)