mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
Merge pull request #1266 from maticnetwork/master
Back merge master to develop after v1.3.3 release
This commit is contained in:
commit
d0a212b4d0
12 changed files with 53 additions and 15 deletions
|
|
@ -40,10 +40,15 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
maxUncleDist = 7 // Maximum allowed backward distance from the chain head
|
||||
maxQueueDist = 32 // Maximum allowed distance from the chain head to queue
|
||||
hashLimit = 256 // Maximum number of unique blocks or headers a peer may have announced
|
||||
blockLimit = 64 // Maximum number of unique blocks a peer may have delivered
|
||||
maxUncleDist = 7 // Maximum allowed backward distance from the chain head
|
||||
|
||||
// maxQueueDist is increased for bor to allow storing more block announcements
|
||||
// near chain tip
|
||||
maxQueueDist = 32 * 6 // Maximum allowed distance from the chain head to queue
|
||||
hashLimit = 256 // Maximum number of unique blocks or headers a peer may have announced
|
||||
|
||||
// blockLimit is increased for bor to allow storing more unique blocks near chain tip
|
||||
blockLimit = 64 * 3 // Maximum number of unique blocks a peer may have delivered
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -244,8 +244,8 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks uint64, unresolvedL
|
|||
return common.Big0, nil, nil, nil, fmt.Errorf("%w: %f", errInvalidPercentile, p)
|
||||
}
|
||||
|
||||
if i > 0 && p < rewardPercentiles[i-1] {
|
||||
return common.Big0, nil, nil, nil, fmt.Errorf("%w: #%d:%f > #%d:%f", errInvalidPercentile, i-1, rewardPercentiles[i-1], i, p)
|
||||
if i > 0 && p <= rewardPercentiles[i-1] {
|
||||
return common.Big0, nil, nil, nil, fmt.Errorf("%w: #%d:%f >= #%d:%f", errInvalidPercentile, i-1, rewardPercentiles[i-1], i, p)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -610,13 +610,30 @@ func (h *handler) BroadcastBlock(block *types.Block, propagate bool) {
|
|||
log.Error("Propagating dangling block", "number", block.Number(), "hash", hash)
|
||||
return
|
||||
}
|
||||
|
||||
// These are the static and trusted peers which are not
|
||||
// in `transfer := peers[:int(math.Sqrt(float64(len(peers))))]`
|
||||
staticAndTrustedPeers := []*ethPeer{}
|
||||
|
||||
for _, peer := range peers[int(math.Sqrt(float64(len(peers)))):] {
|
||||
if peer.IsTrusted() || peer.IsStatic() {
|
||||
staticAndTrustedPeers = append(staticAndTrustedPeers, peer)
|
||||
}
|
||||
}
|
||||
|
||||
// Send the block to a subset of our peers
|
||||
transfer := peers[:int(math.Sqrt(float64(len(peers))))]
|
||||
for _, peer := range transfer {
|
||||
peer.AsyncSendNewBlock(block, td)
|
||||
}
|
||||
|
||||
log.Trace("Propagated block", "hash", hash, "recipients", len(transfer), "duration", common.PrettyDuration(time.Since(block.ReceivedAt)))
|
||||
// Send the block to the trusted and static peers
|
||||
for _, peer := range staticAndTrustedPeers {
|
||||
log.Trace("Propagating block to static and trusted peer", "hash", hash, "peerID", peer.ID())
|
||||
peer.AsyncSendNewBlock(block, td)
|
||||
}
|
||||
|
||||
log.Debug("Propagated block", "hash", hash, "recipients", len(transfer), "static and trusted recipients", len(staticAndTrustedPeers), "duration", common.PrettyDuration(time.Since(block.ReceivedAt)))
|
||||
|
||||
return
|
||||
}
|
||||
|
|
@ -626,7 +643,7 @@ func (h *handler) BroadcastBlock(block *types.Block, propagate bool) {
|
|||
peer.AsyncSendNewBlockHash(block)
|
||||
}
|
||||
|
||||
log.Trace("Announced block", "hash", hash, "recipients", len(peers), "duration", common.PrettyDuration(time.Since(block.ReceivedAt)))
|
||||
log.Debug("Announced block", "hash", hash, "recipients", len(peers), "duration", common.PrettyDuration(time.Since(block.ReceivedAt)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -470,6 +470,16 @@ func (p *Peer) RequestTxs(hashes []common.Hash) error {
|
|||
})
|
||||
}
|
||||
|
||||
// IsTrusted returns whether the peer is a trusted peer or not.
|
||||
func (p *Peer) IsTrusted() bool {
|
||||
return p.Info().Network.Trusted
|
||||
}
|
||||
|
||||
// IsStatic returns whether the peer is a static peer or not.
|
||||
func (p *Peer) IsStatic() bool {
|
||||
return p.Info().Network.Static
|
||||
}
|
||||
|
||||
// knownCache is a cache for known hashes.
|
||||
type knownCache struct {
|
||||
hashes mapset.Set[common.Hash]
|
||||
|
|
|
|||
|
|
@ -734,6 +734,12 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
|
|||
}
|
||||
}
|
||||
|
||||
// It's weird, but it's possible that the block is nil here.
|
||||
// even though the check for error is done above.
|
||||
if block == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
header = block.Header()
|
||||
td = fullBackend.GetTd(context.Background(), header.Hash())
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor
|
||||
Version: 1.3.2
|
||||
Version: 1.3.3
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor
|
||||
Version: 1.3.2
|
||||
Version: 1.3.3
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.3.2
|
||||
Version: 1.3.3
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.3.2
|
||||
Version: 1.3.3
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.3.2
|
||||
Version: 1.3.3
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.3.2
|
||||
Version: 1.3.3
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import (
|
|||
const (
|
||||
VersionMajor = 1 // Major version component of the current release
|
||||
VersionMinor = 3 // Minor version component of the current release
|
||||
VersionPatch = 2 // Patch version component of the current release
|
||||
VersionPatch = 3 // Patch version component of the current release
|
||||
VersionMeta = "" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue