mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Merge pull request #1013 from maticnetwork/master-to-develop
Backport master to develop after v1.0.4
This commit is contained in:
commit
ef38194156
13 changed files with 71 additions and 22 deletions
|
|
@ -2195,7 +2195,7 @@ func RegisterFilterAPI(stack *node.Node, backend ethapi.Backend, ethcfg *ethconf
|
|||
LogCacheSize: ethcfg.FilterLogCacheSize,
|
||||
})
|
||||
|
||||
filterAPI := filters.NewFilterAPI(filterSystem, isLightClient, ethconfig.Defaults.BorLogs)
|
||||
filterAPI := filters.NewFilterAPI(filterSystem, isLightClient, ethcfg.BorLogs)
|
||||
stack.RegisterAPIs([]rpc.API{{
|
||||
Namespace: "eth",
|
||||
Service: filterAPI,
|
||||
|
|
|
|||
|
|
@ -825,6 +825,9 @@ func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error {
|
|||
// return core.ErrInsufficientFunds
|
||||
// }
|
||||
// Verify that replacing transactions will not result in overdraft
|
||||
pool.pendingMu.RLock()
|
||||
defer pool.pendingMu.RUnlock()
|
||||
|
||||
list := pool.pending[from]
|
||||
if list != nil { // Sender already has pending txs
|
||||
sum := new(big.Int).Add(tx.Cost(), list.totalcost)
|
||||
|
|
|
|||
|
|
@ -5,17 +5,21 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/internal/cli/flagset"
|
||||
"github.com/ethereum/go-ethereum/internal/cli/server"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/metrics"
|
||||
"github.com/ethereum/go-ethereum/metrics/prometheus"
|
||||
"github.com/ethereum/go-ethereum/p2p/discover"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/p2p/nat"
|
||||
|
|
@ -26,14 +30,16 @@ import (
|
|||
type BootnodeCommand struct {
|
||||
UI cli.Ui
|
||||
|
||||
listenAddr string
|
||||
v5 bool
|
||||
verbosity int
|
||||
logLevel string
|
||||
nat string
|
||||
nodeKey string
|
||||
saveKey string
|
||||
dryRun bool
|
||||
listenAddr string
|
||||
enableMetrics bool
|
||||
prometheusAddr string
|
||||
v5 bool
|
||||
verbosity int
|
||||
logLevel string
|
||||
nat string
|
||||
nodeKey string
|
||||
saveKey string
|
||||
dryRun bool
|
||||
}
|
||||
|
||||
// Help implements the cli.Command interface
|
||||
|
|
@ -60,6 +66,18 @@ func (b *BootnodeCommand) Flags() *flagset.Flagset {
|
|||
Usage: "listening address of bootnode (<ip>:<port>)",
|
||||
Value: &b.listenAddr,
|
||||
})
|
||||
flags.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "metrics",
|
||||
Usage: "Enable metrics collection and reporting",
|
||||
Value: &b.enableMetrics,
|
||||
Default: true,
|
||||
})
|
||||
flags.StringFlag(&flagset.StringFlag{
|
||||
Name: "prometheus-addr",
|
||||
Default: "127.0.0.1:7071",
|
||||
Usage: "listening address of bootnode (<ip>:<port>)",
|
||||
Value: &b.prometheusAddr,
|
||||
})
|
||||
flags.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "v5",
|
||||
Default: false,
|
||||
|
|
@ -237,6 +255,26 @@ func (b *BootnodeCommand) Run(args []string) int {
|
|||
}
|
||||
}
|
||||
|
||||
if b.enableMetrics {
|
||||
prometheusMux := http.NewServeMux()
|
||||
|
||||
prometheusMux.Handle("/debug/metrics/prometheus", prometheus.Handler(metrics.DefaultRegistry))
|
||||
|
||||
promServer := &http.Server{
|
||||
Addr: b.prometheusAddr,
|
||||
Handler: prometheusMux,
|
||||
ReadHeaderTimeout: 30 * time.Second,
|
||||
}
|
||||
|
||||
go func() {
|
||||
if err := promServer.ListenAndServe(); err != nil {
|
||||
log.Error("Failure in running Prometheus server", "err", err)
|
||||
}
|
||||
}()
|
||||
|
||||
log.Info("Enabling metrics export to prometheus", "path", fmt.Sprintf("http://%s/debug/metrics/prometheus", b.prometheusAddr))
|
||||
}
|
||||
|
||||
signalCh := make(chan os.Signal, 4)
|
||||
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor
|
||||
Version: 1.0.0-beta
|
||||
Version: 1.0.4
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor
|
||||
Version: 1.0.0-beta
|
||||
Version: 1.0.4
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.0.0-beta
|
||||
Version: 1.0.4
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.0.0-beta
|
||||
Version: 1.0.4
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.0.0-beta
|
||||
Version: 1.0.4
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.0.0-beta
|
||||
Version: 1.0.4
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
VersionMajor = 1 // Major version component of the current release
|
||||
VersionMinor = 0 // Minor version component of the current release
|
||||
VersionPatch = 0 // Patch version component of the current release
|
||||
VersionMeta = "beta" // Version metadata to append to the version string
|
||||
VersionMajor = 1 // Major version component of the current release
|
||||
VersionMinor = 0 // Minor version component of the current release
|
||||
VersionPatch = 4 // Patch version component of the current release
|
||||
VersionMeta = "" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
var GitCommit string
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ type SafePool struct {
|
|||
service string // the service using ep
|
||||
processed atomic.Int64 // keeps count of total processed requests
|
||||
|
||||
close chan struct{}
|
||||
close chan struct{}
|
||||
closeOnce sync.Once
|
||||
|
||||
// Skip sending task to execution pool
|
||||
fastPath bool
|
||||
|
|
@ -103,7 +104,9 @@ func (s *SafePool) Size() int {
|
|||
}
|
||||
|
||||
func (s *SafePool) Stop() {
|
||||
close(s.close)
|
||||
s.closeOnce.Do(func() {
|
||||
close(s.close)
|
||||
})
|
||||
|
||||
if s.executionPool.Load() != nil {
|
||||
s.executionPool.Load().Stop()
|
||||
|
|
|
|||
|
|
@ -302,6 +302,7 @@ func (h *handler) close(err error, inflightReq *requestOp) {
|
|||
h.callWG.Wait()
|
||||
h.cancelRoot()
|
||||
h.cancelServerSubscriptions(err)
|
||||
h.executionPool.Stop()
|
||||
}
|
||||
|
||||
// addRequestOp registers a request operation.
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
|
|
@ -48,7 +49,8 @@ type Trie struct {
|
|||
|
||||
// tracer is the tool to track the trie changes.
|
||||
// It will be reset after each commit operation.
|
||||
tracer *tracer
|
||||
tracer *tracer
|
||||
tracerMutex sync.Mutex
|
||||
}
|
||||
|
||||
// newFlag returns the cache flag value for a newly created node.
|
||||
|
|
@ -605,7 +607,9 @@ func (t *Trie) resolveAndTrack(n hashNode, prefix []byte) (node, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
t.tracerMutex.Lock()
|
||||
t.tracer.onRead(prefix, blob)
|
||||
t.tracerMutex.Unlock()
|
||||
|
||||
return mustDecodeNode(n, blob), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue