mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
m1 mine block but only broadcast block wait m2 validate
This commit is contained in:
parent
3f1aadb861
commit
f0761106f4
2 changed files with 10 additions and 7 deletions
|
|
@ -20,7 +20,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
|
@ -706,11 +705,10 @@ func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool) {
|
|||
return
|
||||
}
|
||||
// Send the block to a subset of our peers
|
||||
transfer := peers[:int(math.Sqrt(float64(len(peers))))]
|
||||
for _, peer := range transfer {
|
||||
for _, peer := range peers {
|
||||
peer.SendNewBlock(block, td)
|
||||
}
|
||||
log.Trace("Propagated block", "hash", hash, "recipients", len(transfer), "duration", common.PrettyDuration(time.Since(block.ReceivedAt)))
|
||||
log.Trace("Propagated block", "hash", hash, "recipients", len(peers), "duration", common.PrettyDuration(time.Since(block.ReceivedAt)))
|
||||
return
|
||||
}
|
||||
// Otherwise if the block is indeed in out own chain, announce it
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
// Copyright 2015 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
|
|
@ -301,6 +302,10 @@ func (self *worker) wait() {
|
|||
continue
|
||||
}
|
||||
block := result.Block
|
||||
if self.config.XDPoS != nil && block.NumberU64() >= self.config.XDPoS.Epoch {
|
||||
self.mux.Post(core.NewMinedBlockEvent{Block: block})
|
||||
continue
|
||||
}
|
||||
work := result.Work
|
||||
|
||||
// Update the block hash in all logs since it is now available and not when the
|
||||
|
|
@ -641,7 +646,7 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB
|
|||
// Check whether the tx is replay protected. If we're not in the EIP155 hf
|
||||
// phase, start ignoring the sender until we do.
|
||||
if tx.Protected() && !env.config.IsEIP155(env.header.Number) {
|
||||
log.Debug("Ignoring reply protected special transaction", "hash", tx.Hash(), "eip155", env.config.EIP155Block)
|
||||
log.Trace("Ignoring reply protected special transaction", "hash", tx.Hash(), "eip155", env.config.EIP155Block)
|
||||
continue
|
||||
}
|
||||
// Start executing the transaction
|
||||
|
|
@ -650,11 +655,11 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB
|
|||
switch err {
|
||||
case core.ErrNonceTooLow:
|
||||
// New head notification data race between the transaction pool and miner, shift
|
||||
log.Debug("Skipping special transaction with low nonce", "sender", from, "nonce", tx.Nonce(), "to", tx.To())
|
||||
log.Trace("Skipping special transaction with low nonce", "sender", from, "nonce", tx.Nonce(), "to", tx.To())
|
||||
|
||||
case core.ErrNonceTooHigh:
|
||||
// Reorg notification data race between the transaction pool and miner, skip account =
|
||||
log.Debug("Skipping account with special transaction hight nonce", "sender", from, "nonce", tx.Nonce(), "to", tx.To())
|
||||
log.Trace("Skipping account with special transaction hight nonce", "sender", from, "nonce", tx.Nonce(), "to", tx.To())
|
||||
|
||||
case nil:
|
||||
// Everything ok, collect the logs and shift in the next transaction from the same account
|
||||
|
|
|
|||
Loading…
Reference in a new issue