Merge #7671: [RPC] Add generatetoaddress rpc to mine to an address
d5c5c71RPC tests for generatetoaddress (Andrew C)fe00ca7Create generatetoaddress rpc (Andrew C)
This commit is contained in:
@@ -29,5 +29,19 @@ class DisableWalletTest (BitcoinTestFramework):
|
||||
x = self.nodes[0].validateaddress('mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')
|
||||
assert(x['isvalid'] == True)
|
||||
|
||||
# Checking mining to an address without a wallet
|
||||
try:
|
||||
self.nodes[0].generatetoaddress(1, 'mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')
|
||||
except JSONRPCException,e:
|
||||
assert("Invalid address" not in e.error['message'])
|
||||
assert("ProcessNewBlock, block not accepted" not in e.error['message'])
|
||||
assert("Couldn't create new block" not in e.error['message'])
|
||||
|
||||
try:
|
||||
self.nodes[0].generatetoaddress(1, '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
|
||||
raise AssertionError("Must not mine to invalid address!")
|
||||
except JSONRPCException,e:
|
||||
assert("Invalid address" in e.error['message'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
DisableWalletTest ().main ()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user