Skip to content

Prepare LN for large networks #737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
433 changes: 157 additions & 276 deletions resources/scenarios/ln_framework/ln.py

Large diffs are not rendered by default.

265 changes: 169 additions & 96 deletions resources/scenarios/ln_init.py

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/warnet/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def check_logging_required(directory: Path):
return True
if default_file.get("metricsExport", False):
return True
if default_file.get("lnd", False).get("metricsExport"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to use {} for the default value
if default_file.get("lnd", {}).get("metricsExport"):

return True

# check to see if individual nodes have logging enabled
network_file_path = directory / NETWORK_FILE
Expand All @@ -216,6 +218,8 @@ def check_logging_required(directory: Path):
return True
if node.get("metricsExport", False):
return True
if node.get("lnd", False).get("metricsExport"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ same problem

return True

return False

Expand Down
12 changes: 8 additions & 4 deletions src/warnet/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
from rich.console import Console
from rich.table import Table

from resources.scenarios.ln_framework.ln import Policy
from resources.scenarios.ln_framework.ln import (
CHANNEL_OPEN_START_HEIGHT,
CHANNEL_OPENS_PER_BLOCK,
Policy,
)

from .constants import (
DEFAULT_IMAGE_REPO,
Expand Down Expand Up @@ -339,8 +343,8 @@ def _import_network(graph_file_path, output_path):

sorted_edges = sorted(graph["edges"], key=lambda x: int(x["channel_id"]))

# By default we start including channel open txs in block 300
block = 300
# Start including channel open txs at this block height
block = CHANNEL_OPEN_START_HEIGHT
# Coinbase occupies the 0 position!
index = 1
count = 0
Expand All @@ -356,7 +360,7 @@ def _import_network(graph_file_path, output_path):
}
tanks[source]["lnd"]["channels"].append(channel)
index += 1
if index > 250:
if index > CHANNEL_OPENS_PER_BLOCK:
index = 1
block += 1
count += 1
Expand Down
Loading
Loading