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

Support 'pending' block in RPC #1007

Merged
merged 2 commits into from
Apr 28, 2016
Merged

Support 'pending' block in RPC #1007

merged 2 commits into from
Apr 28, 2016

Conversation

arkpar
Copy link
Collaborator

@arkpar arkpar commented Apr 27, 2016

Partially takes care of #926

@arkpar arkpar added the A0-pleasereview 🤓 Pull request needs code review. label Apr 27, 2016

fn balance(&self, address: &Address) -> U256 {
let sealing_work = self.sealing_work.lock().unwrap();
sealing_work.peek_last_ref().map_or(x!(0), |b| b.block().fields().state.balance(address))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could use self.map_sealing_work this would actually enable and prepare sealing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to actually start sealing here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about when there's no work (peer_last_ref() returns None) and it is querying an account with a non-zero balance?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now miner will forward calls to client if not sealing. Checking sealing status in RPC module would be a subject to race condition. This whole module needs to be refactored later. Miner module should keep a reference to BlockChainClient

@gavofyork gavofyork 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 Apr 28, 2016
@arkpar arkpar 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 Apr 28, 2016
@gavofyork
Copy link
Contributor

looks better now - are there any tests?

@gavofyork gavofyork merged commit 8f7624f into master Apr 28, 2016
@gavofyork gavofyork deleted the pending-rpc branch April 28, 2016 19:47
@arkpar
Copy link
Collaborator Author

arkpar commented Apr 29, 2016

Tests would require substantial refactoring of TestMinerService and TestBlockChainClient. Tested manually for now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-pleasereview 🤓 Pull request needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants