status page

This commit is contained in:
StijnBTC 2021-07-30 12:49:23 +02:00
parent 7c6f8f58a2
commit eb87bb51da
No known key found for this signature in database
GPG key ID: B1E4DFC4452D1E7F
13 changed files with 3528 additions and 1633 deletions

66
channels.txt Normal file
View file

@ -0,0 +1,66 @@
760272708314857473
760273807724773377
760274907239677953
760274907239743489
762249630219239425
722473697600208897
721885458837536769
760272708288380928
760273807750987777
760283703431593985
760315589304385537
760367266252193793
760422241825587201
760377161886728193
760339778468380672
760437635027173377
760279305279045633
760281504442220545
760281504439926785
760399152149299201
760435435931303937
760361768684552193
760276006797705217
760278205917364225
760277106257952769
760273807735783425
762257326725464064
760279305258336257
760270509245071361
760271608870338561
760280404831895553
760270509245005825
760284802831745025
760359569680695296
760289200953294848
760294698547019777
760383758935523329
760289200943857665
760403550225301505
760354072181342209
760292499501678593
760415644758573057
760435435986419713
760415644772139008
760421142326935553
760415644772204545
760415644772335617
760415644774105089
760427739440218113
760449729720745985
760633348010606593
760909325480689665
760453028190420993
760456326686310400
760444232132001793
760597064138358785
760449729740668929
760454127672492033
760449729739751425
760587168604225537
760517899301224449
760512401815896065
760449729719566337
760449729720877057
760506904253104129
760533292541149184

File diff suppressed because one or more lines are too long

View file

@ -1,184 +0,0 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from grpc_generated import router_pb2 as router__pb2
class RouterStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.SendPayment = channel.unary_stream(
'/routerrpc.Router/SendPayment',
request_serializer=router__pb2.SendPaymentRequest.SerializeToString,
response_deserializer=router__pb2.PaymentStatus.FromString,
)
self.TrackPayment = channel.unary_stream(
'/routerrpc.Router/TrackPayment',
request_serializer=router__pb2.TrackPaymentRequest.SerializeToString,
response_deserializer=router__pb2.PaymentStatus.FromString,
)
self.EstimateRouteFee = channel.unary_unary(
'/routerrpc.Router/EstimateRouteFee',
request_serializer=router__pb2.RouteFeeRequest.SerializeToString,
response_deserializer=router__pb2.RouteFeeResponse.FromString,
)
self.SendToRoute = channel.unary_unary(
'/routerrpc.Router/SendToRoute',
request_serializer=router__pb2.SendToRouteRequest.SerializeToString,
response_deserializer=router__pb2.SendToRouteResponse.FromString,
)
self.ResetMissionControl = channel.unary_unary(
'/routerrpc.Router/ResetMissionControl',
request_serializer=router__pb2.ResetMissionControlRequest.SerializeToString,
response_deserializer=router__pb2.ResetMissionControlResponse.FromString,
)
self.QueryMissionControl = channel.unary_unary(
'/routerrpc.Router/QueryMissionControl',
request_serializer=router__pb2.QueryMissionControlRequest.SerializeToString,
response_deserializer=router__pb2.QueryMissionControlResponse.FromString,
)
self.QueryProbability = channel.unary_unary(
'/routerrpc.Router/QueryProbability',
request_serializer=router__pb2.QueryProbabilityRequest.SerializeToString,
response_deserializer=router__pb2.QueryProbabilityResponse.FromString,
)
self.BuildRoute = channel.unary_unary(
'/routerrpc.Router/BuildRoute',
request_serializer=router__pb2.BuildRouteRequest.SerializeToString,
response_deserializer=router__pb2.BuildRouteResponse.FromString,
)
class RouterServicer(object):
# missing associated documentation comment in .proto file
pass
def SendPayment(self, request, context):
"""*
SendPayment attempts to route a payment described by the passed
PaymentRequest to the final destination. The call returns a stream of
payment status updates.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def TrackPayment(self, request, context):
"""*
TrackPayment returns an update stream for the payment identified by the
payment hash.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def EstimateRouteFee(self, request, context):
"""*
EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
may cost to send an HTLC to the target end destination.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SendToRoute(self, request, context):
"""*
SendToRoute attempts to make a payment via the specified route. This method
differs from SendPayment in that it allows users to specify a full route
manually. This can be used for things like rebalancing, and atomic swaps.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ResetMissionControl(self, request, context):
"""*
ResetMissionControl clears all mission control state and starts with a clean
slate.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def QueryMissionControl(self, request, context):
"""*
QueryMissionControl exposes the internal mission control state to callers.
It is a development feature.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def QueryProbability(self, request, context):
"""*
QueryProbability returns the current success probability estimate for a
given node pair and amount.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def BuildRoute(self, request, context):
"""*
BuildRoute builds a fully specified route based on a list of hop public
keys. It retrieves the relevant channel policies from the graph in order to
calculate the correct fees and time locks.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_RouterServicer_to_server(servicer, server):
rpc_method_handlers = {
'SendPayment': grpc.unary_stream_rpc_method_handler(
servicer.SendPayment,
request_deserializer=router__pb2.SendPaymentRequest.FromString,
response_serializer=router__pb2.PaymentStatus.SerializeToString,
),
'TrackPayment': grpc.unary_stream_rpc_method_handler(
servicer.TrackPayment,
request_deserializer=router__pb2.TrackPaymentRequest.FromString,
response_serializer=router__pb2.PaymentStatus.SerializeToString,
),
'EstimateRouteFee': grpc.unary_unary_rpc_method_handler(
servicer.EstimateRouteFee,
request_deserializer=router__pb2.RouteFeeRequest.FromString,
response_serializer=router__pb2.RouteFeeResponse.SerializeToString,
),
'SendToRoute': grpc.unary_unary_rpc_method_handler(
servicer.SendToRoute,
request_deserializer=router__pb2.SendToRouteRequest.FromString,
response_serializer=router__pb2.SendToRouteResponse.SerializeToString,
),
'ResetMissionControl': grpc.unary_unary_rpc_method_handler(
servicer.ResetMissionControl,
request_deserializer=router__pb2.ResetMissionControlRequest.FromString,
response_serializer=router__pb2.ResetMissionControlResponse.SerializeToString,
),
'QueryMissionControl': grpc.unary_unary_rpc_method_handler(
servicer.QueryMissionControl,
request_deserializer=router__pb2.QueryMissionControlRequest.FromString,
response_serializer=router__pb2.QueryMissionControlResponse.SerializeToString,
),
'QueryProbability': grpc.unary_unary_rpc_method_handler(
servicer.QueryProbability,
request_deserializer=router__pb2.QueryProbabilityRequest.FromString,
response_serializer=router__pb2.QueryProbabilityResponse.SerializeToString,
),
'BuildRoute': grpc.unary_unary_rpc_method_handler(
servicer.BuildRoute,
request_deserializer=router__pb2.BuildRouteRequest.FromString,
response_serializer=router__pb2.BuildRouteResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'routerrpc.Router', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))

0
grpc_gen/__init__.py Normal file
View file

View file

@ -2,7 +2,7 @@
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import lightning_pb2 as lightning__pb2
from grpc_gen import lightning_pb2 as lightning__pb2
class LightningStub(object):

2573
grpc_gen/router_pb2.py Normal file

File diff suppressed because one or more lines are too long

666
grpc_gen/router_pb2_grpc.py Normal file
View file

@ -0,0 +1,666 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from grpc_gen import lightning_pb2 as lightning__pb2
from grpc_gen import router_pb2 as router__pb2
class RouterStub(object):
"""Router is a service that offers advanced interaction with the router
subsystem of the daemon.
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.SendPaymentV2 = channel.unary_stream(
'/routerrpc.Router/SendPaymentV2',
request_serializer=router__pb2.SendPaymentRequest.SerializeToString,
response_deserializer=lightning__pb2.Payment.FromString,
)
self.TrackPaymentV2 = channel.unary_stream(
'/routerrpc.Router/TrackPaymentV2',
request_serializer=router__pb2.TrackPaymentRequest.SerializeToString,
response_deserializer=lightning__pb2.Payment.FromString,
)
self.EstimateRouteFee = channel.unary_unary(
'/routerrpc.Router/EstimateRouteFee',
request_serializer=router__pb2.RouteFeeRequest.SerializeToString,
response_deserializer=router__pb2.RouteFeeResponse.FromString,
)
self.SendToRoute = channel.unary_unary(
'/routerrpc.Router/SendToRoute',
request_serializer=router__pb2.SendToRouteRequest.SerializeToString,
response_deserializer=router__pb2.SendToRouteResponse.FromString,
)
self.SendToRouteV2 = channel.unary_unary(
'/routerrpc.Router/SendToRouteV2',
request_serializer=router__pb2.SendToRouteRequest.SerializeToString,
response_deserializer=lightning__pb2.HTLCAttempt.FromString,
)
self.ResetMissionControl = channel.unary_unary(
'/routerrpc.Router/ResetMissionControl',
request_serializer=router__pb2.ResetMissionControlRequest.SerializeToString,
response_deserializer=router__pb2.ResetMissionControlResponse.FromString,
)
self.QueryMissionControl = channel.unary_unary(
'/routerrpc.Router/QueryMissionControl',
request_serializer=router__pb2.QueryMissionControlRequest.SerializeToString,
response_deserializer=router__pb2.QueryMissionControlResponse.FromString,
)
self.XImportMissionControl = channel.unary_unary(
'/routerrpc.Router/XImportMissionControl',
request_serializer=router__pb2.XImportMissionControlRequest.SerializeToString,
response_deserializer=router__pb2.XImportMissionControlResponse.FromString,
)
self.GetMissionControlConfig = channel.unary_unary(
'/routerrpc.Router/GetMissionControlConfig',
request_serializer=router__pb2.GetMissionControlConfigRequest.SerializeToString,
response_deserializer=router__pb2.GetMissionControlConfigResponse.FromString,
)
self.SetMissionControlConfig = channel.unary_unary(
'/routerrpc.Router/SetMissionControlConfig',
request_serializer=router__pb2.SetMissionControlConfigRequest.SerializeToString,
response_deserializer=router__pb2.SetMissionControlConfigResponse.FromString,
)
self.QueryProbability = channel.unary_unary(
'/routerrpc.Router/QueryProbability',
request_serializer=router__pb2.QueryProbabilityRequest.SerializeToString,
response_deserializer=router__pb2.QueryProbabilityResponse.FromString,
)
self.BuildRoute = channel.unary_unary(
'/routerrpc.Router/BuildRoute',
request_serializer=router__pb2.BuildRouteRequest.SerializeToString,
response_deserializer=router__pb2.BuildRouteResponse.FromString,
)
self.SubscribeHtlcEvents = channel.unary_stream(
'/routerrpc.Router/SubscribeHtlcEvents',
request_serializer=router__pb2.SubscribeHtlcEventsRequest.SerializeToString,
response_deserializer=router__pb2.HtlcEvent.FromString,
)
self.SendPayment = channel.unary_stream(
'/routerrpc.Router/SendPayment',
request_serializer=router__pb2.SendPaymentRequest.SerializeToString,
response_deserializer=router__pb2.PaymentStatus.FromString,
)
self.TrackPayment = channel.unary_stream(
'/routerrpc.Router/TrackPayment',
request_serializer=router__pb2.TrackPaymentRequest.SerializeToString,
response_deserializer=router__pb2.PaymentStatus.FromString,
)
self.HtlcInterceptor = channel.stream_stream(
'/routerrpc.Router/HtlcInterceptor',
request_serializer=router__pb2.ForwardHtlcInterceptResponse.SerializeToString,
response_deserializer=router__pb2.ForwardHtlcInterceptRequest.FromString,
)
self.UpdateChanStatus = channel.unary_unary(
'/routerrpc.Router/UpdateChanStatus',
request_serializer=router__pb2.UpdateChanStatusRequest.SerializeToString,
response_deserializer=router__pb2.UpdateChanStatusResponse.FromString,
)
class RouterServicer(object):
"""Router is a service that offers advanced interaction with the router
subsystem of the daemon.
"""
def SendPaymentV2(self, request, context):
"""
SendPaymentV2 attempts to route a payment described by the passed
PaymentRequest to the final destination. The call returns a stream of
payment updates.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def TrackPaymentV2(self, request, context):
"""
TrackPaymentV2 returns an update stream for the payment identified by the
payment hash.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def EstimateRouteFee(self, request, context):
"""
EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
may cost to send an HTLC to the target end destination.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SendToRoute(self, request, context):
"""
Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
the specified route. This method differs from SendPayment in that it
allows users to specify a full route manually. This can be used for
things like rebalancing, and atomic swaps. It differs from the newer
SendToRouteV2 in that it doesn't return the full HTLC information.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SendToRouteV2(self, request, context):
"""
SendToRouteV2 attempts to make a payment via the specified route. This
method differs from SendPayment in that it allows users to specify a full
route manually. This can be used for things like rebalancing, and atomic
swaps.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ResetMissionControl(self, request, context):
"""
ResetMissionControl clears all mission control state and starts with a clean
slate.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def QueryMissionControl(self, request, context):
"""
QueryMissionControl exposes the internal mission control state to callers.
It is a development feature.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def XImportMissionControl(self, request, context):
"""
XImportMissionControl is an experimental API that imports the state provided
to the internal mission control's state, using all results which are more
recent than our existing values. These values will only be imported
in-memory, and will not be persisted across restarts.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def GetMissionControlConfig(self, request, context):
"""
GetMissionControlConfig returns mission control's current config.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SetMissionControlConfig(self, request, context):
"""
SetMissionControlConfig will set mission control's config, if the config
provided is valid.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def QueryProbability(self, request, context):
"""
QueryProbability returns the current success probability estimate for a
given node pair and amount.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def BuildRoute(self, request, context):
"""
BuildRoute builds a fully specified route based on a list of hop public
keys. It retrieves the relevant channel policies from the graph in order to
calculate the correct fees and time locks.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SubscribeHtlcEvents(self, request, context):
"""
SubscribeHtlcEvents creates a uni-directional stream from the server to
the client which delivers a stream of htlc events.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SendPayment(self, request, context):
"""
Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
described by the passed PaymentRequest to the final destination. The call
returns a stream of payment status updates.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def TrackPayment(self, request, context):
"""
Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
the payment identified by the payment hash.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def HtlcInterceptor(self, request_iterator, context):
"""*
HtlcInterceptor dispatches a bi-directional streaming RPC in which
Forwarded HTLC requests are sent to the client and the client responds with
a boolean that tells LND if this htlc should be intercepted.
In case of interception, the htlc can be either settled, cancelled or
resumed later by using the ResolveHoldForward endpoint.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def UpdateChanStatus(self, request, context):
"""
UpdateChanStatus attempts to manually set the state of a channel
(enabled, disabled, or auto). A manual "disable" request will cause the
channel to stay disabled until a subsequent manual request of either
"enable" or "auto".
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_RouterServicer_to_server(servicer, server):
rpc_method_handlers = {
'SendPaymentV2': grpc.unary_stream_rpc_method_handler(
servicer.SendPaymentV2,
request_deserializer=router__pb2.SendPaymentRequest.FromString,
response_serializer=lightning__pb2.Payment.SerializeToString,
),
'TrackPaymentV2': grpc.unary_stream_rpc_method_handler(
servicer.TrackPaymentV2,
request_deserializer=router__pb2.TrackPaymentRequest.FromString,
response_serializer=lightning__pb2.Payment.SerializeToString,
),
'EstimateRouteFee': grpc.unary_unary_rpc_method_handler(
servicer.EstimateRouteFee,
request_deserializer=router__pb2.RouteFeeRequest.FromString,
response_serializer=router__pb2.RouteFeeResponse.SerializeToString,
),
'SendToRoute': grpc.unary_unary_rpc_method_handler(
servicer.SendToRoute,
request_deserializer=router__pb2.SendToRouteRequest.FromString,
response_serializer=router__pb2.SendToRouteResponse.SerializeToString,
),
'SendToRouteV2': grpc.unary_unary_rpc_method_handler(
servicer.SendToRouteV2,
request_deserializer=router__pb2.SendToRouteRequest.FromString,
response_serializer=lightning__pb2.HTLCAttempt.SerializeToString,
),
'ResetMissionControl': grpc.unary_unary_rpc_method_handler(
servicer.ResetMissionControl,
request_deserializer=router__pb2.ResetMissionControlRequest.FromString,
response_serializer=router__pb2.ResetMissionControlResponse.SerializeToString,
),
'QueryMissionControl': grpc.unary_unary_rpc_method_handler(
servicer.QueryMissionControl,
request_deserializer=router__pb2.QueryMissionControlRequest.FromString,
response_serializer=router__pb2.QueryMissionControlResponse.SerializeToString,
),
'XImportMissionControl': grpc.unary_unary_rpc_method_handler(
servicer.XImportMissionControl,
request_deserializer=router__pb2.XImportMissionControlRequest.FromString,
response_serializer=router__pb2.XImportMissionControlResponse.SerializeToString,
),
'GetMissionControlConfig': grpc.unary_unary_rpc_method_handler(
servicer.GetMissionControlConfig,
request_deserializer=router__pb2.GetMissionControlConfigRequest.FromString,
response_serializer=router__pb2.GetMissionControlConfigResponse.SerializeToString,
),
'SetMissionControlConfig': grpc.unary_unary_rpc_method_handler(
servicer.SetMissionControlConfig,
request_deserializer=router__pb2.SetMissionControlConfigRequest.FromString,
response_serializer=router__pb2.SetMissionControlConfigResponse.SerializeToString,
),
'QueryProbability': grpc.unary_unary_rpc_method_handler(
servicer.QueryProbability,
request_deserializer=router__pb2.QueryProbabilityRequest.FromString,
response_serializer=router__pb2.QueryProbabilityResponse.SerializeToString,
),
'BuildRoute': grpc.unary_unary_rpc_method_handler(
servicer.BuildRoute,
request_deserializer=router__pb2.BuildRouteRequest.FromString,
response_serializer=router__pb2.BuildRouteResponse.SerializeToString,
),
'SubscribeHtlcEvents': grpc.unary_stream_rpc_method_handler(
servicer.SubscribeHtlcEvents,
request_deserializer=router__pb2.SubscribeHtlcEventsRequest.FromString,
response_serializer=router__pb2.HtlcEvent.SerializeToString,
),
'SendPayment': grpc.unary_stream_rpc_method_handler(
servicer.SendPayment,
request_deserializer=router__pb2.SendPaymentRequest.FromString,
response_serializer=router__pb2.PaymentStatus.SerializeToString,
),
'TrackPayment': grpc.unary_stream_rpc_method_handler(
servicer.TrackPayment,
request_deserializer=router__pb2.TrackPaymentRequest.FromString,
response_serializer=router__pb2.PaymentStatus.SerializeToString,
),
'HtlcInterceptor': grpc.stream_stream_rpc_method_handler(
servicer.HtlcInterceptor,
request_deserializer=router__pb2.ForwardHtlcInterceptResponse.FromString,
response_serializer=router__pb2.ForwardHtlcInterceptRequest.SerializeToString,
),
'UpdateChanStatus': grpc.unary_unary_rpc_method_handler(
servicer.UpdateChanStatus,
request_deserializer=router__pb2.UpdateChanStatusRequest.FromString,
response_serializer=router__pb2.UpdateChanStatusResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'routerrpc.Router', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class Router(object):
"""Router is a service that offers advanced interaction with the router
subsystem of the daemon.
"""
@staticmethod
def SendPaymentV2(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/routerrpc.Router/SendPaymentV2',
router__pb2.SendPaymentRequest.SerializeToString,
lightning__pb2.Payment.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def TrackPaymentV2(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/routerrpc.Router/TrackPaymentV2',
router__pb2.TrackPaymentRequest.SerializeToString,
lightning__pb2.Payment.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def EstimateRouteFee(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/EstimateRouteFee',
router__pb2.RouteFeeRequest.SerializeToString,
router__pb2.RouteFeeResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SendToRoute(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/SendToRoute',
router__pb2.SendToRouteRequest.SerializeToString,
router__pb2.SendToRouteResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SendToRouteV2(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/SendToRouteV2',
router__pb2.SendToRouteRequest.SerializeToString,
lightning__pb2.HTLCAttempt.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ResetMissionControl(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/ResetMissionControl',
router__pb2.ResetMissionControlRequest.SerializeToString,
router__pb2.ResetMissionControlResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def QueryMissionControl(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/QueryMissionControl',
router__pb2.QueryMissionControlRequest.SerializeToString,
router__pb2.QueryMissionControlResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def XImportMissionControl(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/XImportMissionControl',
router__pb2.XImportMissionControlRequest.SerializeToString,
router__pb2.XImportMissionControlResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetMissionControlConfig(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/GetMissionControlConfig',
router__pb2.GetMissionControlConfigRequest.SerializeToString,
router__pb2.GetMissionControlConfigResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SetMissionControlConfig(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/SetMissionControlConfig',
router__pb2.SetMissionControlConfigRequest.SerializeToString,
router__pb2.SetMissionControlConfigResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def QueryProbability(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/QueryProbability',
router__pb2.QueryProbabilityRequest.SerializeToString,
router__pb2.QueryProbabilityResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def BuildRoute(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/BuildRoute',
router__pb2.BuildRouteRequest.SerializeToString,
router__pb2.BuildRouteResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SubscribeHtlcEvents(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/routerrpc.Router/SubscribeHtlcEvents',
router__pb2.SubscribeHtlcEventsRequest.SerializeToString,
router__pb2.HtlcEvent.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SendPayment(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/routerrpc.Router/SendPayment',
router__pb2.SendPaymentRequest.SerializeToString,
router__pb2.PaymentStatus.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def TrackPayment(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/routerrpc.Router/TrackPayment',
router__pb2.TrackPaymentRequest.SerializeToString,
router__pb2.PaymentStatus.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def HtlcInterceptor(request_iterator,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.stream_stream(request_iterator, target, '/routerrpc.Router/HtlcInterceptor',
router__pb2.ForwardHtlcInterceptResponse.SerializeToString,
router__pb2.ForwardHtlcInterceptRequest.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def UpdateChanStatus(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/routerrpc.Router/UpdateChanStatus',
router__pb2.UpdateChanStatusRequest.SerializeToString,
router__pb2.UpdateChanStatusResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

61
lnd.py Normal file
View file

@ -0,0 +1,61 @@
import codecs
import os
from functools import lru_cache
from os.path import expanduser
import grpc
from grpc_gen import router_pb2 as lnrouter
from grpc_gen import router_pb2_grpc as lnrouterrpc
from grpc_gen import lightning_pb2 as ln
from grpc_gen import lightning_bp2_grpc as lnrpc
MESSAGE_SIZE_MB = 50 * 1024 * 1024
class Lnd:
def __init__(self, lnd_dir, server):
os.environ["GRPC_SSL_CIPHER_SUITES"] = "HIGH+ECDSA"
lnd_dir = expanduser(lnd_dir)
combined_credentials = self.get_credentials(lnd_dir)
channel_options = [
("grpc.max_message_length", MESSAGE_SIZE_MB),
("grpc.max_receive_message_length", MESSAGE_SIZE_MB),
]
grpc_channel = grpc.secure_channel(
server, combined_credentials, channel_options
)
self.stub = lnrpc.LightningStub(grpc_channel)
self.router_stub = lnrouterrpc.RouterStub(grpc_channel)
@staticmethod
def get_credentials(lnd_dir):
with open(f"{lnd_dir}/tls.cert", "rb") as f:
tls_certificate = f.read()
ssl_credentials = grpc.ssl_channel_credentials(tls_certificate)
with open(f"{lnd_dir}/data/chain/bitcoin/mainnet/admin.macaroon", "rb") as f:
macaroon = codecs.encode(f.read(), "hex")
auth_credentials = grpc.metadata_call_credentials(
lambda _, callback: callback([("macaroon", macaroon)], None)
)
combined_credentials = grpc.composite_channel_credentials(
ssl_credentials, auth_credentials
)
return combined_credentials
# TODO: handle invalid channel ids
@lru_cache(maxsize=None)
def get_edge(self, channel_id):
return self.stub.GetChanInfo(ln.ChanInfoRequest(chan_id=channel_id))
@lru_cache(maxsize=None)
def get_node_alias(self, pub_key):
return self.stub.GetNodeInfo(
ln.NodeInfoRequest(pub_key=pub_key, include_channels=False)
).node.alias
@lru_cache(maxsize=None)
def get_node(self, pub_key):
return self.stub.GetNodeInfo(
ln.NodeInfoRequest(pub_key=pub_key, include_channels=False)
).node

38
output.py Normal file
View file

@ -0,0 +1,38 @@
import os
import sys
from yachalk import chalk
class Output:
def __init__(self, lnd):
self.lnd = lnd
@staticmethod
def print_line(message, end='\n'):
sys.stdout.write(f"{message}{end}")
@staticmethod
def print_without_linebreak(message):
sys.stdout.write(message)
def format_alias(alias):
if not sys.stdout.encoding.lower().startswith('utf'):
alias = alias.encode('latin-1', 'ignore').decode()
return chalk.bold(alias)
def format_error(error):
return chalk.red(error)
def format_channel(channel_id, node1_alias, node2_alias, chanDisabled):
text = f'{channel_id:<18} {format_alias(node1_alias):<32} {format_alias(node2_alias):<32}'
if chanDisabled:
return chalk.bg_red(text)
else:
return text
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')

4
requirements.txt Normal file
View file

@ -0,0 +1,4 @@
googleapis-common-protos==1.53.0
grpcio==1.39.0
protobuf==3.17.3
yachalk==0.1.4

68
ringtools.py Normal file
View file

@ -0,0 +1,68 @@
import argparse
import sys
from lnd import Lnd
from output import Output
from status import Status
class RingTools:
def __init__(self, arguments):
self.lnd = Lnd(arguments.lnddir, arguments.grpc)
self.output = Output(self.lnd)
self.arguments = arguments
def start(self):
print(self.arguments.function)
if self.arguments.function == "status":
Status(self.lnd, self.output, self.arguments.channels_file, self.arguments.loop).run()
pass
def main():
argument_parser = get_argument_parser()
arguments = argument_parser.parse_args()
return RingTools(arguments).start()
def get_argument_parser():
parser = argparse.ArgumentParser()
# This is needed for the cert and macaroon of LND
parser.add_argument(
"--lnddir",
default="~/.lnd",
dest="lnddir",
help="(default ~/.lnd) lnd directory",
)
parser.add_argument(
"--grpc",
default="localhost:10009",
dest="grpc",
help="(default localhost:10009) lnd gRPC endpoint",
)
parser.add_argument(dest="function", choices=['status'])
status_group = parser.add_argument_group(
"status",
"Get the current status of all channels",
)
status_group.add_argument(
"-channels-file",
"-f",
default="./channels.txt",
dest="channels_file",
help="(default ./channels.txt) channels file"
)
status_group.add_argument(
"-l",
"--loop",
action="store_true",
dest="loop",
help="(default False) Keeps checking channel status"
)
return parser
success = main()
if success:
sys.exit(0)
sys.exit(1)

51
status.py Normal file
View file

@ -0,0 +1,51 @@
import os
import re
from time import sleep
from output import format_error, Output, format_alias, clear_screen, format_channel
LOOP_SLEEP_TIME = 10
class Status:
def __init__(self, lnd, output, channels_file, keep_loop):
self.lnd = lnd
self.output = output
self.channels_file = channels_file
self.keep_loop = keep_loop
print(channels_file)
def read_file(self, file):
if not os.path.isfile(file):
self.handle_error("File does not exist")
else:
with open(self.channels_file) as file:
return file.read().splitlines()
def run(self):
if self.keep_loop:
self.loop()
else:
self.once()
def loop(self):
while True:
clear_screen()
self.once()
sleep(LOOP_SLEEP_TIME)
def once(self):
channels = self.read_file(self.channels_file)
for channelID in channels:
response = self.lnd.get_edge(int(channelID))
node1 = self.lnd.get_node(response.node1_pub)
node2 = self.lnd.get_node(response.node2_pub)
disabled = response.node1_policy.disabled or response.node2_policy.disabled
# print(response)
self.print_channel(response.channel_id, node1.alias, node2.alias, disabled)
def print_channel(self, channel_id, node1_alias, node2_alias, chan_disabled):
self.output.print_line(format_channel(channel_id, node1_alias, node2_alias, chan_disabled))
def handle_error(self, error):
self.output.print_line(format_error(error))