Categorygithub.com/ziggie1984/Distributed-Mission-Control-for-LND
modulepackage
0.0.0-20240920123447-fb14e126c9ae
Repository: https://github.com/ziggie1984/distributed-mission-control-for-lnd.git
Documentation: pkg.go.dev

# README

Distributed-Mission-Control for LND

This project creates an external coordination service which aggregates Mission Control Data from different lightning nodes and makes the data available via an API.

Mission Control is LND's central path finding brain. Overtime, clients will populate this brain with empirical observations, in order to derive a more accurate model of the path finding network at a given instance. Today all clients need to deal with a cold start issue where to start with, they have no observations. The “XImportMissionControl” API call in LND can be used to allow clients to start with a hot cache. This project would use LND’s Mission Control API calls to implement a dynamic system where clients export their mission control observations to a coordination service that then figures out how to intelligently merge the observations into a unified data set. This can then be used to implement fast bootstrap for LND nodes and increase payment success rates.

This project is part of the https://github.com/lightningnetwork ecosystem.

High-Level Design Architecture

DMC for LND High-Level Design Architecture

Blog Posts

# Packages

Package ecrpc is a reverse proxy.

# Functions

AppPath returns the application path based on the OS.
CreateThirdPartyTLSDirIfNotExist checks if the directory for third-party TLS certificates exists, and creates it if it does not.
DefaultConfig returns a Config initialized with default values.
EnsureAppPathExists ensures the application directory exists.
NewExternalCoordinatorServer creates a new instance of ExternalCoordinatorServer.

# Constants

AppDirPermissions defines the permissions for main application directory.
ConfigFilePermissions defines the permissions for configuration files.
DatabaseBucketName specifies the default name of the bucket used within the bbolt database for mission control data.
DatabaseDirPermissions defines the permissions for database directories.
DatabaseFilePermissions defines the permissions for database files.
DefaultAppName is the default app name for the external coordinator service.
DefaultConfigFilename is the default filename for the server configuration file.
DefaultDatabaseDirname is the default directory name for storing database files.
DefaultDatabaseFileLockTimeout specifies the default duration to wait for acquiring a file lock on the database before giving up.
DefaultDatabaseFilename is the default filename for the mission control database.
DefaultGrpcServerHost specifies the default host address that the gRPC server will bind to.
DefaultGrpcServerPort specifies the default port that the gRPC server will listen on.
DefaultHistoryThresholdDuration specifies the default duration threshold for history data pair, set to 7 days.
DefaultLogDirname is the default directory name for storing log files.
DefaultLogFilename is the default filename for the server's operational log.
DefaultLogLevel specifies the default logging level used across the application.
DefaultMaxBatchDelay specifies the default maximum delay before a batch of database write operations is committed.
DefaultMaxBatchSize specifies the default maximum number of database write operations that can be batched together.
DefaultPProfServerHost specifies the default host address that the pprof server will bind to.
DefaultPProfServerPort specifies the default port that the pprof server will listen on.
DefaultQueryMissionControlBatchSize specifies the default number of pairs to be sent in each batch when querying the aggregated mission control data.
DefaultRestServerHost specifies the default host address that the REST server will bind to.
DefaultRestServerPort specifies the default port that the REST server will listen on.
DefaultStaleDataCleanupInterval specifies the default interval for cleaning up stale mission control data from the database, set to 24 hours i.e.
DefaultThirdPartyTLSDirname is the default directory name for storing third-party TLS certificates.
DefaultTLSCertFilename is the default filename for the TLS self-signed certificate used by the server.
DefaultTLSDomainName is the default domain name for tls certificates.
DefaultTLSKeyFilename is the default filename for the TLS key associated with the server's certificate.
LogDirPermissions defines the permissions for log directories.
LogFilePermissions defines the permissions for log files.
MinFailureRelaxInterval is the minimum time that must have passed since the previously recorded failure before the failure amount may be raised in the context of mission control data.
PubKeyCompressedSize is the size of a single compressed sec pub key in bytes.
PubKeyCompressedSizeDouble is the size of compressed sec pub keys for both the source and destination nodes in the mission control data pair.
ThirdPartyTLSDirPermissions defines the permissions for third-party TLS directories.

# Variables

DefaultMarshalOptions defines the marshalling options for JSON output in the gRPC-Gateway.

# Structs

Config holds the overall configuration values for the server.
DatabaseConfig holds the database configuration values.
LogConfig holds the log configuration values.
PProfConfig holds the pprof configuration values.
ServerConfig holds the server configuration values.
TLSConfig holds the TLS configuration values.

# Interfaces

GRPCServer defines an interface for a gRPC server.
HTTPServer defines an interface for an HTTP server.