Open shohu opened 6 years ago
testcode
def run_test(self):
# Track test coverage statistics
self.restart_counts = [0, 0, 0] # Track the restarts for nodes 0-2
self.crashed_on_restart = 0 # Track count of crashes during recovery
# Start by creating a lot of utxos on node3
initial_height = self.nodes[3].getblockcount()
utxo_list = create_confirmed_utxos(self.nodes[3].getnetworkinfo()['relayfee'], self.nodes[3], 5000)
self.log.info("Prepped %d utxo entries", len(utxo_list))
# Helper to create at least "count" utxos
# Pass in a fee that is sufficient for relay and mining new transactions.
def create_confirmed_utxos(fee, node, count):
to_generate = int(0.5 * count) + 101
while to_generate > 0:
node.generate(min(25, to_generate))
to_generate -= 25
utxos = node.listunspent()
iterations = count - len(utxos)
addr1 = node.getnewaddress()
addr2 = node.getnewaddress()
if iterations <= 0:
return utxos
for i in range(iterations):
t = utxos.pop()
inputs = []
inputs.append({"txid": t["txid"], "vout": t["vout"]})
outputs = {}
send_value = t['amount'] - fee
outputs[addr1] = satoshi_round(send_value / 2)
outputs[addr2] = satoshi_round(send_value / 2)
raw_tx = node.createrawtransaction(inputs, outputs) ### Error was occured !
signed_tx = node.signrawtransaction(raw_tx)["hex"]
node.sendrawtransaction(signed_tx)
while (node.getmempoolinfo()['size'] > 0):
node.generate(1)
utxos = node.listunspent()
assert(len(utxos) >= count)
return utxos
Block height is 2801 when error was occured. So block reward is 0....
(Pdb) node.getinfo()
{'walletversion': 139900, 'errors': '', 'blocks': 2801, 'testnet': False, 'timeoffset': 0, 'paytxfee': Decimal('0E-8'), 'keypoololdest': 1521770570, 'connections': 0, 'difficulty': Decimal('4.656542373906925E-10'), 'version': 150100, 'deprecation-warning': 'WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16', 'keypoolsize': 1, 'protocolversion': 70015, 'proxy': '', 'balance': Decimal('18700000.00000000'), 'relayfee': Decimal('0.00001000')}
I changed "the block generation speed". I passed it 👍 https://github.com/shohu/c0ban/issues/20#issuecomment-376396793
# test/functional/dbcrash.py
2018-03-27 05:02:24.052000 TestFramework (INFO): Initializing test directory /tmp/testg8204d3a
2018-03-27 05:02:39.711000 TestFramework (INFO): Prepped 5001 utxo entries
2018-03-27 05:03:10.626000 TestFramework (INFO): Iteration 0, generating 2500 transactions [0, 0, 0]
2018-03-27 05:03:18.640000 TestFramework (INFO): Iteration 1, generating 2500 transactions [0, 0, 0]
2018-03-27 05:03:27.734000 TestFramework (INFO): Iteration 2, generating 2500 transactions [1, 0, 0]
2018-03-27 05:03:36.166000 TestFramework (INFO): Iteration 3, generating 2500 transactions [1, 0, 0]
2018-03-27 05:03:45.190000 TestFramework (INFO): Iteration 4, generating 2500 transactions [1, 0, 0]
2018-03-27 05:04:06.546000 TestFramework (INFO): Iteration 5, generating 2500 transactions [2, 0, 0]
2018-03-27 05:04:16.391000 TestFramework (INFO): Iteration 6, generating 2500 transactions [3, 0, 0]
2018-03-27 05:04:26.661000 TestFramework (INFO): Iteration 7, generating 2500 transactions [4, 0, 0]
2018-03-27 05:04:35.851000 TestFramework (INFO): Iteration 8, generating 2500 transactions [4, 0, 0]
2018-03-27 05:04:45.183000 TestFramework (INFO): Iteration 9, generating 2500 transactions [4, 0, 0]
2018-03-27 05:04:55.066000 TestFramework (INFO): Iteration 10, generating 2500 transactions [4, 0, 0]
2018-03-27 05:05:06.565000 TestFramework (INFO): Iteration 11, generating 2500 transactions [5, 0, 0]
2018-03-27 05:05:15.203000 TestFramework (INFO): Iteration 12, generating 2500 transactions [5, 0, 0]
2018-03-27 05:05:42.884000 TestFramework (INFO): Iteration 13, generating 2500 transactions [6, 0, 0]
2018-03-27 05:05:52.829000 TestFramework (INFO): Iteration 14, generating 2500 transactions [7, 0, 0]
2018-03-27 05:06:01.702000 TestFramework (INFO): Iteration 15, generating 2500 transactions [7, 0, 0]
2018-03-27 05:06:10.188000 TestFramework (INFO): Iteration 16, generating 2500 transactions [7, 0, 0]
2018-03-27 05:06:19.292000 TestFramework (INFO): Iteration 17, generating 2500 transactions [7, 0, 0]
2018-03-27 05:06:28.738000 TestFramework (INFO): Iteration 18, generating 2500 transactions [8, 0, 0]
2018-03-27 05:06:55.375000 TestFramework (INFO): Iteration 19, generating 2500 transactions [9, 0, 0]
2018-03-27 05:06:57.721000 TestFramework (INFO): Iteration 20, generating 2500 transactions [9, 0, 0]
2018-03-27 05:07:01.117000 TestFramework (INFO): Iteration 21, generating 2500 transactions [9, 0, 0]
2018-03-27 05:07:05.988000 TestFramework (INFO): Iteration 22, generating 2500 transactions [9, 0, 0]
2018-03-27 05:07:13.511000 TestFramework (INFO): Iteration 23, generating 2500 transactions [9, 0, 0]
2018-03-27 05:07:22.063000 TestFramework (INFO): Iteration 24, generating 2500 transactions [9, 0, 0]
2018-03-27 05:07:32.766000 TestFramework (INFO): Iteration 25, generating 2500 transactions [10, 0, 0]
2018-03-27 05:07:43.097000 TestFramework (INFO): Iteration 26, generating 2500 transactions [11, 0, 0]
2018-03-27 05:07:52.292000 TestFramework (INFO): Iteration 27, generating 2500 transactions [11, 0, 0]
2018-03-27 05:08:02.649000 TestFramework (INFO): Iteration 28, generating 2500 transactions [11, 0, 0]
2018-03-27 05:08:11.091000 TestFramework (INFO): Iteration 29, generating 2500 transactions [11, 0, 0]
2018-03-27 05:08:20.883000 TestFramework (INFO): Iteration 30, generating 2500 transactions [11, 0, 0]
2018-03-27 05:08:32.782000 TestFramework (INFO): Iteration 31, generating 2500 transactions [12, 0, 1]
2018-03-27 05:08:43.717000 TestFramework (INFO): Iteration 32, generating 2500 transactions [13, 0, 1]
2018-03-27 05:08:53.076000 TestFramework (INFO): Iteration 33, generating 2500 transactions [13, 0, 1]
2018-03-27 05:09:03.613000 TestFramework (INFO): Iteration 34, generating 2500 transactions [13, 0, 1]
2018-03-27 05:09:13.867000 TestFramework (INFO): Iteration 35, generating 2500 transactions [13, 0, 1]
2018-03-27 05:09:23.402000 TestFramework (INFO): Iteration 36, generating 2500 transactions [13, 0, 1]
2018-03-27 05:09:36.266000 TestFramework (INFO): Iteration 37, generating 2500 transactions [14, 1, 1]
2018-03-27 05:09:50.208000 TestFramework (INFO): Iteration 38, generating 2500 transactions [15, 1, 1]
2018-03-27 05:09:59.726000 TestFramework (INFO): Iteration 39, generating 2500 transactions [15, 1, 1]
2018-03-27 05:10:15.247000 TestFramework (INFO): Verifying utxo hash matches for all nodes
2018-03-27 05:10:18.352000 TestFramework (INFO): Restarted nodes: [16, 2, 1]; crashes on restart: 19
2018-03-27 05:10:18.352000 TestFramework (INFO): Stopping nodes
2018-03-27 05:10:21.083000 TestFramework (INFO): Cleaning up
2018-03-27 05:10:21.209000 TestFramework (INFO): Tests successful