[qa] check if wallet or blochchain maintenance changes the balance

This commit is contained in:
MarcoFalke 2015-12-18 12:35:50 +01:00
parent fa0765d433
commit fa14d99484

View file

@ -197,8 +197,9 @@ class WalletTest (BitcoinTestFramework):
self.nodes[1].sendrawtransaction(txObjNotBroadcasted['hex']) self.nodes[1].sendrawtransaction(txObjNotBroadcasted['hex'])
self.nodes[1].generate(1) self.nodes[1].generate(1)
self.sync_all() self.sync_all()
node_2_bal += 2
txObjNotBroadcasted = self.nodes[0].gettransaction(txIdNotBroadcasted) txObjNotBroadcasted = self.nodes[0].gettransaction(txIdNotBroadcasted)
assert_equal(self.nodes[2].getbalance(), node_2_bal + Decimal('2')) #should not be assert_equal(self.nodes[2].getbalance(), node_2_bal)
#create another tx #create another tx
txIdNotBroadcasted = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2) txIdNotBroadcasted = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2)
@ -214,9 +215,10 @@ class WalletTest (BitcoinTestFramework):
self.nodes[0].generate(1) self.nodes[0].generate(1)
sync_blocks(self.nodes) sync_blocks(self.nodes)
node_2_bal += 2
#tx should be added to balance because after restarting the nodes tx should be broadcastet #tx should be added to balance because after restarting the nodes tx should be broadcastet
assert_equal(self.nodes[2].getbalance(), node_2_bal + Decimal('4')) #should not be assert_equal(self.nodes[2].getbalance(), node_2_bal)
#send a tx with value in a string (PR#6380 +) #send a tx with value in a string (PR#6380 +)
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "2") txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "2")
@ -249,6 +251,29 @@ class WalletTest (BitcoinTestFramework):
assert_equal("not an integer" in errorString, True) assert_equal("not an integer" in errorString, True)
#check if wallet or blochchain maintenance changes the balance
self.sync_all()
self.nodes[0].generate(1)
self.sync_all()
balance_nodes = [self.nodes[i].getbalance() for i in range(3)]
maintenance = [
'-rescan',
'-reindex',
'-zapwallettxes=1',
'-zapwallettxes=2',
'-salvagewallet',
]
for m in maintenance:
stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(3, self.options.tmpdir, [[m]] * 3)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
self.sync_all()
assert_equal(balance_nodes, [self.nodes[i].getbalance() for i in range(3)])
if __name__ == '__main__': if __name__ == '__main__':
WalletTest ().main () WalletTest ().main ()