diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-09-21 20:36:29 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-10-19 15:03:09 +0800 |
commit | c33cc382b3561ca91871111933f81653bfd8532f (patch) | |
tree | 0749dd4e4ebd66efe1272ee984e4dda06b4462be /eth/handler.go | |
parent | 92f9a3e5fa29e0f05c81b348b87cab4f7a94f0c8 (diff) | |
download | dexon-c33cc382b3561ca91871111933f81653bfd8532f.tar.gz dexon-c33cc382b3561ca91871111933f81653bfd8532f.tar.zst dexon-c33cc382b3561ca91871111933f81653bfd8532f.zip |
core: support inserting pure header chains
Diffstat (limited to 'eth/handler.go')
-rw-r--r-- | eth/handler.go | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/eth/handler.go b/eth/handler.go index 5716350af..021be1024 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -589,15 +589,6 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { } request.Block.ReceivedAt = msg.ReceivedAt - // Mark the block's arrival for whatever reason - _, chainHead, _ := pm.blockchain.Status() - jsonlogger.LogJson(&logger.EthChainReceivedNewBlock{ - BlockHash: request.Block.Hash().Hex(), - BlockNumber: request.Block.Number(), - ChainHeadHash: chainHead.Hex(), - BlockPrevHash: request.Block.ParentHash().Hex(), - RemoteId: p.ID().String(), - }) // Mark the peer as owning the block and schedule it for import p.MarkBlock(request.Block.Hash()) p.SetHead(request.Block.Hash()) @@ -607,7 +598,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { // Update the peers total difficulty if needed, schedule a download if gapped if request.TD.Cmp(p.Td()) > 0 { p.SetTd(request.TD) - if request.TD.Cmp(new(big.Int).Add(pm.blockchain.Td(), request.Block.Difficulty())) > 0 { + td := pm.blockchain.GetTd(pm.blockchain.CurrentBlock().Hash()) + if request.TD.Cmp(new(big.Int).Add(td, request.Block.Difficulty())) > 0 { go pm.synchronise(p) } } @@ -624,12 +616,6 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { return errResp(ErrDecode, "transaction %d is nil", i) } p.MarkTransaction(tx.Hash()) - - // Log it's arrival for later analysis - jsonlogger.LogJson(&logger.EthTxReceived{ - TxHash: tx.Hash().Hex(), - RemoteId: p.ID().String(), - }) } pm.txpool.AddTransactions(txs) |