Skip to content

Commit

Permalink
Merge branch 'master' into piersy/ethersjs-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
gastonponti authored Sep 27, 2022
2 parents f8dc1ed + 7019852 commit 8f3e4f6
Show file tree
Hide file tree
Showing 9 changed files with 377 additions and 435 deletions.
22 changes: 9 additions & 13 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,9 @@ var (
Value: 0,
}
defaultSyncMode = ethconfig.Defaults.SyncMode
// TODO: Check if snap sync is enabled
SyncModeFlag = TextMarshalerFlag{
SyncModeFlag = TextMarshalerFlag{
Name: "syncmode",
Usage: `Blockchain sync mode ("fast", "full", "light", or "lightest")`,
Usage: `Blockchain sync mode ("fast", "full", "snap", "light", or "lightest")`,
Value: &defaultSyncMode,
}
GCModeFlag = cli.StringFlag{
Expand Down Expand Up @@ -1733,16 +1732,13 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
cfg.SnapshotCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheSnapshotFlag.Name) / 100
}
if !ctx.GlobalBool(SnapshotFlag.Name) {
// Snap Dync Disabled. See https://github.com/celo-org/celo-blockchain/issues/1735
// // If snap-sync is requested, this flag is also required
// if cfg.SyncMode == downloader.SnapSync {
// log.Info("Snap sync requested, enabling --snapshot")
// } else {
// cfg.TrieCleanCache += cfg.SnapshotCache
// cfg.SnapshotCache = 0 // Disabled
// }
cfg.TrieCleanCache += cfg.SnapshotCache
cfg.SnapshotCache = 0 // Disabled
// If snap-sync is requested, this flag is also required
if cfg.SyncMode == downloader.SnapSync {
log.Info("Snap sync requested, enabling --snapshot")
} else {
cfg.TrieCleanCache += cfg.SnapshotCache
cfg.SnapshotCache = 0 // Disabled
}
}
if ctx.GlobalIsSet(DocRootFlag.Name) {
cfg.DocRoot = ctx.GlobalString(DocRootFlag.Name)
Expand Down
5 changes: 2 additions & 3 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ import (
"github.com/celo-org/celo-blockchain/eth/ethconfig"
"github.com/celo-org/celo-blockchain/eth/filters"
"github.com/celo-org/celo-blockchain/eth/protocols/eth"

// "github.com/celo-org/celo-blockchain/eth/protocols/snap"
"github.com/celo-org/celo-blockchain/eth/protocols/snap"
"github.com/celo-org/celo-blockchain/ethdb"
"github.com/celo-org/celo-blockchain/event"
"github.com/celo-org/celo-blockchain/internal/ethapi"
Expand Down Expand Up @@ -567,7 +566,7 @@ func (s *Ethereum) BloomIndexer() *core.ChainIndexer { return s.bloomIndexer
func (s *Ethereum) Protocols() []p2p.Protocol {
protos := eth.MakeProtocols((*ethHandler)(s.handler), s.networkID, s.ethDialCandidates)
if s.config.SnapshotCache > 0 {
// protos = append(protos, snap.MakeProtocols((*snapHandler)(s.handler), s.snapDialCandidates)...)
protos = append(protos, snap.MakeProtocols((*snapHandler)(s.handler), s.snapDialCandidates)...)
}
return protos
}
Expand Down
Loading

0 comments on commit 8f3e4f6

Please sign in to comment.