aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-19 15:15:20 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-19 15:15:20 +0800
commitd5871fc20022b6d50140cc2b266f98122c6aa3bd (patch)
treeb792043d37e4ad855a8d86629b57eeea7bacae9e
parente4f9ec886b498c5744633a4db1c735eec11dc71b (diff)
parent4180ca7fe47359a80e88186b9127e93af685a81a (diff)
downloaddexon-d5871fc20022b6d50140cc2b266f98122c6aa3bd.tar
dexon-d5871fc20022b6d50140cc2b266f98122c6aa3bd.tar.gz
dexon-d5871fc20022b6d50140cc2b266f98122c6aa3bd.tar.bz2
dexon-d5871fc20022b6d50140cc2b266f98122c6aa3bd.tar.lz
dexon-d5871fc20022b6d50140cc2b266f98122c6aa3bd.tar.xz
dexon-d5871fc20022b6d50140cc2b266f98122c6aa3bd.tar.zst
dexon-d5871fc20022b6d50140cc2b266f98122c6aa3bd.zip
Merge pull request #1295 from karalabe/fix-broadcast-order
eth: fix the propagation/announce order for mined blocks
-rw-r--r--eth/handler.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/eth/handler.go b/eth/handler.go
index a5986b779..ad88e9c59 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -6,7 +6,6 @@ import (
"sync"
"time"
- "github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
@@ -16,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/p2p"
+ "github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/rlp"
)
@@ -307,7 +307,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
blocks = nil
}
// Update the receive timestamp of each block
- for i:=0; i<len(blocks); i++ {
+ for i := 0; i < len(blocks); i++ {
blocks[i].ReceivedAt = msg.ReceivedAt
}
// Filter out any explicitly requested blocks, deliver the rest to the downloader
@@ -417,8 +417,8 @@ func (self *ProtocolManager) minedBroadcastLoop() {
for obj := range self.minedBlockSub.Chan() {
switch ev := obj.(type) {
case core.NewMinedBlockEvent:
- self.BroadcastBlock(ev.Block, false)
- self.BroadcastBlock(ev.Block, true)
+ self.BroadcastBlock(ev.Block, true) // First propagate block to peers
+ self.BroadcastBlock(ev.Block, false) // Only then announce to the rest
}
}
}