This repository has been archived by the owner on Aug 22, 2019. It is now read-only.
Make send transaction work on new chain and added reporting exception #206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.