Skip to content

Commit

Permalink
Added fix to allow getroothash to work with no api running (erigontec…
Browse files Browse the repository at this point in the history
…h#8342)

Whitelisting calculation of the roothash should not be dependent on the
bor api running. This will not always be the case, for example when
erigon is configured with a separate rpc deamon.

To fix this the calculation has been moved to Bor.

Additionally the redundant Bor API code has been removed as this is not
called by any code and the functionality looks to have migrated to the
turbo/jsonrpc package.
  • Loading branch information
mh0lt authored Oct 2, 2023
1 parent 0bdca6c commit 3d6d2a7
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 408 deletions.
13 changes: 10 additions & 3 deletions cmd/rpcdaemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (

"github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli"
"github.com/ledgerwatch/erigon/consensus"
"github.com/ledgerwatch/erigon/consensus/bor"
"github.com/ledgerwatch/erigon/consensus/ethash"
"github.com/ledgerwatch/erigon/rpc"
"github.com/ledgerwatch/erigon/turbo/debug"
Expand All @@ -25,13 +27,18 @@ func main() {
return nil
}
defer db.Close()

var engine consensus.EngineReader

if borDb != nil {
defer borDb.Close()
engine = bor.NewRo(borDb, blockReader, logger)
} else {
// TODO: Replace with correct consensus Engine
engine = ethash.NewFaker()
}

// TODO: Replace with correct consensus Engine
engine := ethash.NewFaker()
apiList := jsonrpc.APIList(db, borDb, backend, txPool, mining, ff, stateCache, blockReader, agg, *cfg, engine, logger)
apiList := jsonrpc.APIList(db, backend, txPool, mining, ff, stateCache, blockReader, agg, *cfg, engine, logger)
rpc.PreAllocateRPCMetricLabels(apiList)
if err := cli.StartRpcServer(ctx, *cfg, apiList, logger); err != nil {
logger.Error(err.Error())
Expand Down
301 changes: 0 additions & 301 deletions consensus/bor/api.go

This file was deleted.

Loading

0 comments on commit 3d6d2a7

Please sign in to comment.