Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Light Client: fetch transactions/receipts by transaction hash #6641

Merged
merged 13 commits into from
Oct 8, 2017

Conversation

rphmeier
Copy link
Contributor

@rphmeier rphmeier commented Oct 4, 2017

Fetching a transaction (for RPC) by hash is different than all other requests because it requires information about the block to be included in the RPC result. The same goes for receipts. This means that we have to request more data after receiving the response before we can check its validity.

Implemented now with a TransactionIndex request. This returns a (block number, block hash, index) tuple. The block is fetched, checked for existence in the local chain, and then searched for the transaction. If we are fetching a receipt, the block receipts are then fetched and the receipt is extracted.

Using the trie roots in the header might be a better approach, but for now repeat requests will mostly draw from cached data and will not have to go to the network for anything heavy.

Also makes light protocol request cost table parsing more lenient, allowing some request types to be present while others might not be. This allows for easy backwards-compatible extension of the light protocol with new request types.

@rphmeier rphmeier added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Oct 4, 2017
@svyatonik
Copy link
Collaborator

@rphmeier There are some compilation errors - have you seen it?

@5chdn 5chdn added A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. and removed A0-pleasereview 🤓 Pull request needs code review. labels Oct 5, 2017
@rphmeier rphmeier added A0-pleasereview 🤓 Pull request needs code review. and removed A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. labels Oct 5, 2017
@NikVolf NikVolf added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Oct 5, 2017
@gavofyork gavofyork merged commit b010fb5 into master Oct 8, 2017
@gavofyork gavofyork deleted the light-tx-by-hash branch October 8, 2017 16:19
@5chdn 5chdn added this to the 1.8 milestone Mar 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants