Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

drahmel
Copy link

@drahmel drahmel commented Nov 1, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant