diff options
author | Andrew C <achow101@gmail.com> | 2016-03-14 17:54:34 -0400 |
---|---|---|
committer | Andrew C <achow101@gmail.com> | 2016-03-21 10:22:29 -0400 |
commit | d5c5c713e67368802b6a4ab2b6b69962364c251b (patch) | |
tree | 7583238d6eb662ce60ae6ef6280f4b0526c8e3cc /qa/rpc-tests/wallet.py | |
parent | fe00ca758a0f1ab2db3f7441c04780630a9df11a (diff) |
RPC tests for generatetoaddress
Adds two RPC tests for the generatetoaddress RPC, one in the wallet, and one when the wallet is disabled.
The wallet RPC Test mines Bitcoin to another node's address and checks that that node has received the Bitcoin.
The RPC test without the wallet mines Bitcoin to an arbitrary address and checks that it works. It then mines to an arbitrary invalid address and checks that that fails.
Diffstat (limited to 'qa/rpc-tests/wallet.py')
-rwxr-xr-x | qa/rpc-tests/wallet.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py index f686e6be6c..df176601a5 100755 --- a/qa/rpc-tests/wallet.py +++ b/qa/rpc-tests/wallet.py @@ -262,6 +262,18 @@ class WalletTest (BitcoinTestFramework): assert("not an integer" in errorString) + # Mine a block from node0 to an address from node1 + cbAddr = self.nodes[1].getnewaddress() + blkHash = self.nodes[0].generatetoaddress(1, cbAddr)[0] + cbTxId = self.nodes[0].getblock(blkHash)['tx'][0] + self.sync_all() + + # Check that the txid and balance is found by node1 + try: + self.nodes[1].gettransaction(cbTxId) + except JSONRPCException,e: + assert("Invalid or non-wallet transaction id" not in e.error['message']) + #check if wallet or blochchain maintenance changes the balance self.sync_all() blocks = self.nodes[0].generate(2) |