diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-03-18 12:18:38 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-03-18 12:23:55 +0100 |
commit | 29e1131c4642459349a0ed4737121fb1902f8a47 (patch) | |
tree | 83be1d3fb1c278bae9149fa4428c2322c6bf0971 /qa/rpc-tests/wallet.py | |
parent | efde86b4aae6cb58c9086c668853fcb8a6dac756 (diff) | |
parent | fa4a52254178655f50e73b50153730a60ffafd32 (diff) | |
download | bitcoin-29e1131c4642459349a0ed4737121fb1902f8a47.tar.xz |
Merge #7702: [qa] Add tests verifychain, lockunspent, getbalance, listsinceblock
fa4a522 [qa] Add tests verifychain, lockunspent, getbalance, listsinceblock (MarcoFalke)
Diffstat (limited to 'qa/rpc-tests/wallet.py')
-rwxr-xr-x | qa/rpc-tests/wallet.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py index 3cd495deb6..e52d4e7668 100755 --- a/qa/rpc-tests/wallet.py +++ b/qa/rpc-tests/wallet.py @@ -59,6 +59,15 @@ class WalletTest (BitcoinTestFramework): self.nodes[0].generate(1) self.sync_all() + # Exercise locking of unspent outputs + unspent_0 = self.nodes[2].listunspent()[0] + unspent_0 = {"txid": unspent_0["txid"], "vout": unspent_0["vout"]} + self.nodes[2].lockunspent(False, [unspent_0]) + assert_raises(JSONRPCException, self.nodes[2].sendtoaddress, self.nodes[2].getnewaddress(), 20) + assert_equal([unspent_0], self.nodes[2].listlockunspent()) + self.nodes[2].lockunspent(True, [unspent_0]) + assert_equal(len(self.nodes[2].listlockunspent()), 0) + # Have node1 generate 100 blocks (so node0 can recover the fee) self.nodes[1].generate(100) self.sync_all() @@ -148,6 +157,10 @@ class WalletTest (BitcoinTestFramework): assert(txid1 in self.nodes[3].getrawmempool()) + # Exercise balance rpcs + assert_equal(self.nodes[0].getwalletinfo()["unconfirmed_balance"], 1) + assert_equal(self.nodes[0].getunconfirmedbalance(), 1) + #check if we can list zero value tx as available coins #1. create rawtx #2. hex-changed one output to 0.0 @@ -251,7 +264,7 @@ class WalletTest (BitcoinTestFramework): #check if wallet or blochchain maintenance changes the balance self.sync_all() - self.nodes[0].generate(1) + blocks = self.nodes[0].generate(2) self.sync_all() balance_nodes = [self.nodes[i].getbalance() for i in range(3)] @@ -269,6 +282,12 @@ class WalletTest (BitcoinTestFramework): self.nodes = start_nodes(3, self.options.tmpdir, [[m]] * 3) assert_equal(balance_nodes, [self.nodes[i].getbalance() for i in range(3)]) + # Exercise listsinceblock with the last two blocks + coinbase_tx_1 = self.nodes[0].listsinceblock(blocks[0]) + assert_equal(coinbase_tx_1["lastblock"], blocks[1]) + assert_equal(len(coinbase_tx_1["transactions"]), 1) + assert_equal(coinbase_tx_1["transactions"][0]["blockhash"], blocks[1]) + assert_equal(len(self.nodes[0].listsinceblock(blocks[1])["transactions"]), 0) if __name__ == '__main__': WalletTest ().main () |