mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
Fixed lint errors from gosimple linter (#4900)
This commit is contained in:
parent
808df67683
commit
8774e1d8a2
@ -21,13 +21,11 @@ func (api *APIImpl) NewPendingTransactionFilter(_ context.Context) (string, erro
|
||||
id := api.filters.SubscribePendingTxs(txsCh)
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case txs, ok := <-txsCh:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
api.filters.AddPendingTxs(id, txs)
|
||||
txs, ok := <-txsCh
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
api.filters.AddPendingTxs(id, txs)
|
||||
}
|
||||
}()
|
||||
return "0x" + string(id), nil
|
||||
@ -42,13 +40,11 @@ func (api *APIImpl) NewBlockFilter(_ context.Context) (string, error) {
|
||||
id := api.filters.SubscribeNewHeads(ch)
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case block, ok := <-ch:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
api.filters.AddPendingBlock(id, block)
|
||||
block, ok := <-ch
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
api.filters.AddPendingBlock(id, block)
|
||||
}
|
||||
}()
|
||||
return "0x" + string(id), nil
|
||||
@ -63,13 +59,11 @@ func (api *APIImpl) NewFilter(_ context.Context, crit filters.FilterCriteria) (s
|
||||
id := api.filters.SubscribeLogs(logs, crit)
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case lg, ok := <-logs:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
api.filters.AddLogs(id, lg)
|
||||
lg, ok := <-logs
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
api.filters.AddLogs(id, lg)
|
||||
}
|
||||
}()
|
||||
return hexutil.EncodeUint64(uint64(id)), nil
|
||||
|
@ -324,8 +324,7 @@ func Erigon22(genesis *core.Genesis, logger log.Logger) error {
|
||||
}
|
||||
startTime := time.Now()
|
||||
var blockReader services.FullBlockReader
|
||||
var allSnapshots *snapshotsync.RoSnapshots
|
||||
allSnapshots = snapshotsync.NewRoSnapshots(ethconfig.NewSnapCfg(true, false, true), path.Join(datadir, "snapshots"))
|
||||
var allSnapshots = snapshotsync.NewRoSnapshots(ethconfig.NewSnapCfg(true, false, true), path.Join(datadir, "snapshots"))
|
||||
defer allSnapshots.Close()
|
||||
if err := allSnapshots.ReopenFolder(); err != nil {
|
||||
return fmt.Errorf("reopen snapshot segments: %w", err)
|
||||
|
@ -155,8 +155,7 @@ func Erigon23(genesis *core.Genesis, chainConfig *params.ChainConfig, logger log
|
||||
}()
|
||||
|
||||
var blockReader services.FullBlockReader
|
||||
var allSnapshots *snapshotsync.RoSnapshots
|
||||
allSnapshots = snapshotsync.NewRoSnapshots(ethconfig.NewSnapCfg(true, false, true), path.Join(datadir, "snapshots"))
|
||||
var allSnapshots = snapshotsync.NewRoSnapshots(ethconfig.NewSnapCfg(true, false, true), path.Join(datadir, "snapshots"))
|
||||
defer allSnapshots.Close()
|
||||
if err := allSnapshots.ReopenFolder(); err != nil {
|
||||
return fmt.Errorf("reopen snapshot segments: %w", err)
|
||||
|
@ -41,8 +41,7 @@ var replayTxCmd = &cobra.Command{
|
||||
|
||||
func ReplayTx(genesis *core.Genesis) error {
|
||||
var blockReader services.FullBlockReader
|
||||
var allSnapshots *snapshotsync.RoSnapshots
|
||||
allSnapshots = snapshotsync.NewRoSnapshots(ethconfig.NewSnapCfg(true, true, true), path.Join(datadir, "snapshots"))
|
||||
var allSnapshots = snapshotsync.NewRoSnapshots(ethconfig.NewSnapCfg(true, true, true), path.Join(datadir, "snapshots"))
|
||||
defer allSnapshots.Close()
|
||||
if err := allSnapshots.ReopenFolder(); err != nil {
|
||||
return fmt.Errorf("reopen snapshot segments: %w", err)
|
||||
|
@ -477,8 +477,7 @@ func Recon(genesis *core.Genesis, logger log.Logger) error {
|
||||
go fillWorkers[i].bitmapAccounts()
|
||||
}
|
||||
for atomic.LoadUint64(&doneCount) < uint64(workerCount) {
|
||||
select {
|
||||
case <-logEvery.C:
|
||||
for range logEvery.C {
|
||||
var m runtime.MemStats
|
||||
libcommon.ReadMemStats(&m)
|
||||
var p float64
|
||||
@ -499,8 +498,7 @@ func Recon(genesis *core.Genesis, logger log.Logger) error {
|
||||
go fillWorkers[i].bitmapStorage()
|
||||
}
|
||||
for atomic.LoadUint64(&doneCount) < uint64(workerCount) {
|
||||
select {
|
||||
case <-logEvery.C:
|
||||
for range logEvery.C {
|
||||
var m runtime.MemStats
|
||||
libcommon.ReadMemStats(&m)
|
||||
var p float64
|
||||
@ -521,8 +519,7 @@ func Recon(genesis *core.Genesis, logger log.Logger) error {
|
||||
go fillWorkers[i].bitmapCode()
|
||||
}
|
||||
for atomic.LoadUint64(&doneCount) < uint64(workerCount) {
|
||||
select {
|
||||
case <-logEvery.C:
|
||||
for range logEvery.C {
|
||||
var m runtime.MemStats
|
||||
libcommon.ReadMemStats(&m)
|
||||
var p float64
|
||||
@ -775,8 +772,7 @@ func Recon(genesis *core.Genesis, logger log.Logger) error {
|
||||
go fillWorkers[i].fillAccounts(plainStateCollectors[i])
|
||||
}
|
||||
for atomic.LoadUint64(&doneCount) < uint64(workerCount) {
|
||||
select {
|
||||
case <-logEvery.C:
|
||||
for range logEvery.C {
|
||||
var m runtime.MemStats
|
||||
libcommon.ReadMemStats(&m)
|
||||
var p float64
|
||||
@ -797,8 +793,7 @@ func Recon(genesis *core.Genesis, logger log.Logger) error {
|
||||
go fillWorkers[i].fillStorage(plainStateCollectors[i])
|
||||
}
|
||||
for atomic.LoadUint64(&doneCount) < uint64(workerCount) {
|
||||
select {
|
||||
case <-logEvery.C:
|
||||
for range logEvery.C {
|
||||
var m runtime.MemStats
|
||||
libcommon.ReadMemStats(&m)
|
||||
var p float64
|
||||
@ -819,8 +814,7 @@ func Recon(genesis *core.Genesis, logger log.Logger) error {
|
||||
go fillWorkers[i].fillCode(codeCollectors[i], plainContractCollectors[i])
|
||||
}
|
||||
for atomic.LoadUint64(&doneCount) < uint64(workerCount) {
|
||||
select {
|
||||
case <-logEvery.C:
|
||||
for range logEvery.C {
|
||||
var m runtime.MemStats
|
||||
libcommon.ReadMemStats(&m)
|
||||
var p float64
|
||||
|
Loading…
Reference in New Issue
Block a user