use own total difficulty to limit best peer
- update blockpool td by subscribing to ChainHeadEvent - if ahead of best peer, demote it - addPeer now take own td as current td - removePeer now take own td as current td - add relevant tests to peers_test - eth: backend now calls blockpool with eth.eventMux and chainManager.Td
This commit is contained in:
@@ -195,7 +195,8 @@ func New(config *Config) (*Ethereum, error) {
|
||||
|
||||
hasBlock := eth.chainManager.HasBlock
|
||||
insertChain := eth.chainManager.InsertChain
|
||||
eth.blockPool = blockpool.New(hasBlock, insertChain, eth.pow.Verify)
|
||||
td := eth.chainManager.Td()
|
||||
eth.blockPool = blockpool.New(hasBlock, insertChain, eth.pow.Verify, eth.EventMux(), td)
|
||||
|
||||
netprv, err := config.nodeKey()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user