fix db path
This commit is contained in:
parent
ca8f8e1549
commit
a41ca36054
|
@ -3,6 +3,7 @@ import concurrent
|
|||
import logging
|
||||
import time
|
||||
from asyncio import Event
|
||||
from pathlib import Path
|
||||
from typing import AsyncGenerator, List, Optional, Tuple, Dict, Type
|
||||
import aiosqlite
|
||||
|
||||
|
@ -70,7 +71,11 @@ class FullNode:
|
|||
|
||||
@classmethod
|
||||
async def create(
|
||||
cls: Type, config: Dict, name: str = None, override_constants={},
|
||||
cls: Type,
|
||||
config: Dict,
|
||||
root_path: Path,
|
||||
name: str = None,
|
||||
override_constants={},
|
||||
):
|
||||
self = cls()
|
||||
|
||||
|
@ -85,7 +90,6 @@ class FullNode:
|
|||
else:
|
||||
self.log = logging.getLogger(__name__)
|
||||
|
||||
root_path = DEFAULT_ROOT_PATH
|
||||
db_path = path_from_root(root_path, config["database_path"])
|
||||
mkdir(db_path.parent)
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ async def async_main():
|
|||
log = logging.getLogger(__name__)
|
||||
server_closed = False
|
||||
|
||||
full_node = await FullNode.create(config)
|
||||
full_node = await FullNode.create(config, root_path=root_path)
|
||||
|
||||
if config["enable_upnp"]:
|
||||
log.info(f"Attempting to enable UPnP (open up port {config['port']})")
|
||||
|
|
|
@ -30,12 +30,12 @@ async def main():
|
|||
log = logging.getLogger(__name__)
|
||||
server_closed = False
|
||||
|
||||
db_path = path_from_root(DEFAULT_ROOT_PATH, config["simulator_database_path"])
|
||||
db_path = path_from_root(root_path, config["simulator_database_path"])
|
||||
mkdir(db_path.parent)
|
||||
db_path.unlink()
|
||||
|
||||
full_node = await FullNodeSimulator.create(
|
||||
config, override_constants=test_constants,
|
||||
config, root_path=root_path, override_constants=test_constants,
|
||||
)
|
||||
|
||||
ping_interval = net_config.get("ping_interval")
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
import asyncio
|
||||
|
||||
from typing import Any, Dict, Tuple, List
|
||||
from pathlib import Path
|
||||
|
||||
import aiosqlite
|
||||
import blspy
|
||||
from secrets import token_bytes
|
||||
|
||||
from src.full_node.blockchain import Blockchain
|
||||
from src.full_node.mempool_manager import MempoolManager
|
||||
from src.full_node.full_node import FullNode
|
||||
from src.server.connection import NodeType
|
||||
from src.server.server import ChiaServer
|
||||
from src.simulator.full_node_simulator import FullNodeSimulator
|
||||
from src.timelord_launcher import spawn_process, kill_processes
|
||||
from src.wallet.wallet_node import WalletNode
|
||||
from src.types.full_block import FullBlock
|
||||
from src.full_node.coin_store import CoinStore
|
||||
from tests.block_tools import BlockTools
|
||||
from src.types.BLSSignature import BLSPublicKey
|
||||
from src.util.config import load_config
|
||||
|
@ -72,7 +63,10 @@ async def setup_full_node_simulator(db_name, port, introducer_port=None, dic={})
|
|||
config["introducer_peer"]["host"] = "127.0.0.1"
|
||||
config["introducer_peer"]["port"] = introducer_port
|
||||
full_node_1 = await FullNodeSimulator.create(
|
||||
config, f"full_node_{port}", test_constants_copy,
|
||||
config=config,
|
||||
name=f"full_node_{port}",
|
||||
root_path=root_path,
|
||||
override_constants=test_constants_copy,
|
||||
)
|
||||
assert ping_interval is not None
|
||||
assert network_id is not None
|
||||
|
@ -117,8 +111,12 @@ async def setup_full_node(db_name, port, introducer_port=None, dic={}):
|
|||
if introducer_port is not None:
|
||||
config["introducer_peer"]["host"] = "127.0.0.1"
|
||||
config["introducer_peer"]["port"] = introducer_port
|
||||
|
||||
full_node_1 = await FullNode.create(
|
||||
config, f"full_node_{port}", test_constants_copy,
|
||||
config=config,
|
||||
root_path=root_path,
|
||||
name=f"full_node_{port}",
|
||||
override_constants=test_constants_copy,
|
||||
)
|
||||
assert ping_interval is not None
|
||||
assert network_id is not None
|
||||
|
|
Loading…
Reference in New Issue