Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrivateMinerSample doesn't include transactions into blocks #709

Closed
Nashatyrev opened this issue Jan 25, 2017 · 4 comments
Closed

PrivateMinerSample doesn't include transactions into blocks #709

Nashatyrev opened this issue Jan 25, 2017 · 4 comments
Assignees
Labels

Comments

@Nashatyrev
Copy link
Member

No description provided.

@Nashatyrev Nashatyrev added the bug label Jan 25, 2017
@Nashatyrev Nashatyrev self-assigned this Jan 25, 2017
@Nashatyrev
Copy link
Member Author

The problem here is that we are not processing inbound transactions until sync is complete. For the miner node the sync is disabled. We had code which enabled tx processing if sync is off but it was accidentally commented by me while refactoring.
However this was not the best solution (to mine without sync process) if consider the following cases:

  • the miner node starts alone and mines blocks from the best block it has, then some node connects which has the chain with higher difficulty. In this case miner should import all blocks and switch mining to the best one
  • the miner node starts alone and mines blocks from the best block it has, then some node connects which has the chain with lower difficulty. In this case the sync is assumed to be done from the very beginning.
  • the miner connects to a node, syncs with it and then starts mining

@Nashatyrev
Copy link
Member Author

For now the following workaround should work for the miner node:

// ethereum - is the miner node instance
ethereum.addListener(new EthereumListenerAdapter() {
    @Override
    public void onHandShakePeer(Channel channel, HelloMessage helloMessage) {
        channel.onSyncDone(true);
    }
});

@Nashatyrev
Copy link
Member Author

The regression is fixed (PrivateMinerSample should work fine), though this issue needs more advanced fix (see the first comment)

@Nashatyrev
Copy link
Member Author

With Unsafe I've got approx. the same performance: 606cd46

Nashatyrev added a commit that referenced this issue Feb 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants