plasma-mvp icon indicating copy to clipboard operation
plasma-mvp copied to clipboard

Make send transaction work on new chain and added reporting exception

Open drahmel opened this issue 6 years ago • 0 comments

When I tried to install and run the plasma MVP, I was getting the following error:

API Exception: {'type': 'KeyError', 'args': (1,), 'message': '1'} Traceback (most recent call last): File "/home/drahmel/plasma-mvp/env/lib/python3.6/site-packages/json_rpc-1.10.8-py3.6.egg/jsonrpc/manager.py", line 112, in _get_responses result = method(*request.args, **request.kwargs) File "plasma/child_chain/server.py", line 21, in dispatcher["apply_transaction"] = lambda transaction: child_chain.apply_transaction(rlp.decode(utils.decode_hex(transaction), Transaction)) File "/home/drahmel/plasma-mvp/plasma/child_chain/child_chain.py", line 37, in apply_transaction self.chain.validate_transaction(tx, self.current_block.spent_utxos) File "/home/drahmel/plasma-mvp/plasma_core/chain.py", line 63, in validate_transaction input_tx = self.blocks[blknum].transaction_set[txindex] KeyError: 1

I tracked it down to a reference to index 1 in the block list which was invalid. If I changed the example to start at index 0, it appeared to work properly.

I changed the example code to use index 0 and also added an exception that caught and described the problem.

When I run the tests, some of the child chain tests now fail throwing the new exception. I don't know the code well enough to know if this is catching a previously silent error or if I have to modify the tests to accommodate the new exception type.

Any feedback would be greatly appreciated.

drahmel avatar Nov 01 '18 20:11 drahmel