mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-24 03:00:25 +00:00
Update Fluffy data directory location based on selected network. (#2400)
This commit is contained in:
parent
0b8363764d
commit
bd2ca07da6
@ -8,7 +8,7 @@
|
|||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/os,
|
std/[os, enumutils],
|
||||||
confutils,
|
confutils,
|
||||||
confutils/std/net,
|
confutils/std/net,
|
||||||
chronicles,
|
chronicles,
|
||||||
@ -60,6 +60,12 @@ proc onOptimisticHeader(
|
|||||||
when lcDataFork > LightClientDataFork.None:
|
when lcDataFork > LightClientDataFork.None:
|
||||||
info "New LC optimistic header", optimistic_header = shortLog(forkyHeader)
|
info "New LC optimistic header", optimistic_header = shortLog(forkyHeader)
|
||||||
|
|
||||||
|
proc getDbDirectory(network: PortalNetwork): string =
|
||||||
|
if network == PortalNetwork.mainnet:
|
||||||
|
"db"
|
||||||
|
else:
|
||||||
|
"db_" & network.symbolName()
|
||||||
|
|
||||||
proc run(config: PortalConf) {.raises: [CatchableError].} =
|
proc run(config: PortalConf) {.raises: [CatchableError].} =
|
||||||
setupLogging(config.logLevel, config.logStdout)
|
setupLogging(config.logLevel, config.logStdout)
|
||||||
|
|
||||||
@ -163,7 +169,7 @@ proc run(config: PortalConf) {.raises: [CatchableError].} =
|
|||||||
# Force pruning
|
# Force pruning
|
||||||
if config.forcePrune:
|
if config.forcePrune:
|
||||||
let db = ContentDB.new(
|
let db = ContentDB.new(
|
||||||
config.dataDir / "db" / "contentdb_" &
|
config.dataDir / portalNetwork.getDbDirectory() / "contentdb_" &
|
||||||
d.localNode.id.toBytesBE().toOpenArray(0, 8).toHex(),
|
d.localNode.id.toBytesBE().toOpenArray(0, 8).toHex(),
|
||||||
storageCapacity = config.storageCapacityMB * 1_000_000,
|
storageCapacity = config.storageCapacityMB * 1_000_000,
|
||||||
manualCheckpoint = true,
|
manualCheckpoint = true,
|
||||||
@ -195,7 +201,7 @@ proc run(config: PortalConf) {.raises: [CatchableError].} =
|
|||||||
# the selected `Radius`.
|
# the selected `Radius`.
|
||||||
let
|
let
|
||||||
db = ContentDB.new(
|
db = ContentDB.new(
|
||||||
config.dataDir / "db" / "contentdb_" &
|
config.dataDir / portalNetwork.getDbDirectory() / "contentdb_" &
|
||||||
d.localNode.id.toBytesBE().toOpenArray(0, 8).toHex(),
|
d.localNode.id.toBytesBE().toOpenArray(0, 8).toHex(),
|
||||||
storageCapacity = config.storageCapacityMB * 1_000_000,
|
storageCapacity = config.storageCapacityMB * 1_000_000,
|
||||||
)
|
)
|
||||||
@ -260,7 +266,6 @@ proc run(config: PortalConf) {.raises: [CatchableError].} =
|
|||||||
config.trustedBlockRoot.isSome():
|
config.trustedBlockRoot.isSome():
|
||||||
let
|
let
|
||||||
# Portal works only over mainnet data currently
|
# Portal works only over mainnet data currently
|
||||||
# TODO: investigate this load network data function
|
|
||||||
networkData = loadNetworkData("mainnet")
|
networkData = loadNetworkData("mainnet")
|
||||||
beaconDb = BeaconDb.new(networkData, config.dataDir / "db" / "beacon_db")
|
beaconDb = BeaconDb.new(networkData, config.dataDir / "db" / "beacon_db")
|
||||||
beaconNetwork = BeaconNetwork.new(
|
beaconNetwork = BeaconNetwork.new(
|
||||||
|
@ -324,7 +324,7 @@ proc processContentLoop(n: BeaconNetwork) {.async: (raises: []).} =
|
|||||||
trace "processContentLoop canceled"
|
trace "processContentLoop canceled"
|
||||||
|
|
||||||
proc start*(n: BeaconNetwork) =
|
proc start*(n: BeaconNetwork) =
|
||||||
info "Starting portal beacon chain network"
|
info "Starting Portal beacon chain network"
|
||||||
n.portalProtocol.start()
|
n.portalProtocol.start()
|
||||||
n.processContentLoop = processContentLoop(n)
|
n.processContentLoop = processContentLoop(n)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user