rpc: implement RPC htlc interceptor.

In this commit we add the ability to intercept forwarded htlc packets
straight from the RPC layer. The RPC layer handles a bidrectional stream
that comminucates to the client the intercepted packets and handles its
response by coordinating with the interceptable switch.
This commit is contained in:
Roei Erez 2020-05-19 12:57:36 +03:00
parent 0f50d8b2ed
commit 7b56268f70
11 changed files with 1224 additions and 154 deletions

View File

@ -211,6 +211,8 @@ http:
# deprecated, no REST endpoint
- selector: routerrpc.Router.TrackPayment
# deprecated, no REST endpoint
- selector: routerrpc.HtlcInterceptor
# request streaming RPC, REST not supported
# signrpc/signer.proto
- selector: signrpc.Signer.SignOutputRaw

View File

@ -0,0 +1,217 @@
package routerrpc
import (
"errors"
"fmt"
"sync"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwire"
)
var (
// ErrFwdNotExists is an error returned when the caller tries to resolve
// a forward that doesn't exist anymore.
ErrFwdNotExists = errors.New("forward does not exist")
// ErrMissingPreimage is an error returned when the caller tries to settle
// a forward and doesn't provide a preimage.
ErrMissingPreimage = errors.New("missing preimage")
)
// forwardInterceptor is a helper struct that handles the lifecycle of an rpc
// interceptor streaming session.
// It is created when the stream opens and disconnects when the stream closes.
type forwardInterceptor struct {
// server is the Server reference
server *Server
// holdForwards is a map of current hold forwards and their corresponding
// ForwardResolver.
holdForwards map[channeldb.CircuitKey]htlcswitch.InterceptedForward
// stream is the bidirectional RPC stream
stream Router_HtlcInterceptorServer
// quit is a channel that is closed when this forwardInterceptor is shutting
// down.
quit chan struct{}
// intercepted is where we stream all intercepted packets coming from
// the switch.
intercepted chan htlcswitch.InterceptedForward
wg sync.WaitGroup
}
// newForwardInterceptor creates a new forwardInterceptor.
func newForwardInterceptor(server *Server, stream Router_HtlcInterceptorServer) *forwardInterceptor {
return &forwardInterceptor{
server: server,
stream: stream,
holdForwards: make(
map[channeldb.CircuitKey]htlcswitch.InterceptedForward),
quit: make(chan struct{}),
intercepted: make(chan htlcswitch.InterceptedForward),
}
}
// run sends the intercepted packets to the client and receives the
// corersponding responses. On one hand it regsitered itself as an interceptor
// that receives the switch packets and on the other hand launches a go routine
// to read from the client stream.
// To coordinate all this and make sure it is safe for concurrent access all
// packets are sent to the main where they are handled.
func (r *forwardInterceptor) run() error {
// make sure we disconnect and resolves all remaining packets if any.
defer r.onDisconnect()
// Register our interceptor so we receive all forwarded packets.
interceptableForwarder := r.server.cfg.RouterBackend.InterceptableForwarder
interceptableForwarder.SetInterceptor(r.onIntercept)
defer interceptableForwarder.SetInterceptor(nil)
// start a go routine that reads client resolutions.
errChan := make(chan error)
resolutionRequests := make(chan *ForwardHtlcInterceptResponse)
r.wg.Add(1)
go r.readClientResponses(resolutionRequests, errChan)
// run the main loop that synchronizes both sides input into one go routine.
for {
select {
case intercepted := <-r.intercepted:
log.Tracef("sending intercepted packet to client %v", intercepted)
// in case we couldn't forward we exit the loop and drain the
// current interceptor as this indicates on a connection problem.
if err := r.holdAndForwardToClient(intercepted); err != nil {
return err
}
case resolution := <-resolutionRequests:
log.Tracef("resolving intercepted packet %v", resolution)
// in case we couldn't resolve we just add a log line since this
// does not indicate on any connection problem.
if err := r.resolveFromClient(resolution); err != nil {
log.Warnf("client resolution of intercepted "+
"packet failed %v", err)
}
case err := <-errChan:
return err
case <-r.server.quit:
return nil
}
}
}
// onIntercept is the function that is called by the switch for every forwarded
// packet. Our interceptor makes sure we hold the packet and then signal to the
// main loop to handle the packet. We only return true if we were able
// to deliver the packet to the main loop.
func (r *forwardInterceptor) onIntercept(p htlcswitch.InterceptedForward) bool {
select {
case r.intercepted <- p:
return true
case <-r.quit:
return false
case <-r.server.quit:
return false
}
}
func (r *forwardInterceptor) readClientResponses(
resolutionChan chan *ForwardHtlcInterceptResponse, errChan chan error) {
defer r.wg.Done()
for {
resp, err := r.stream.Recv()
if err != nil {
errChan <- err
return
}
// Now that we have the response from the RPC client, send it to
// the responses chan.
select {
case resolutionChan <- resp:
case <-r.quit:
return
case <-r.server.quit:
return
}
}
}
// holdAndForwardToClient forwards the intercepted htlc to the client.
func (r *forwardInterceptor) holdAndForwardToClient(
forward htlcswitch.InterceptedForward) error {
htlc := forward.Packet()
inKey := forward.CircuitKey()
// First hold the forward, then send to client.
r.holdForwards[forward.CircuitKey()] = forward
interceptionRequest := &ForwardHtlcInterceptRequest{
IncomingCircuitKey: &CircuitKey{
ChanId: inKey.ChanID.ToUint64(),
HtlcId: inKey.HtlcID,
},
HtlcPaymentHash: htlc.PaymentHash[:],
AmountMsat: uint64(htlc.Amount),
Expiry: htlc.Expiry,
}
return r.stream.Send(interceptionRequest)
}
// resolveFromClient handles a resolution arrived from the client.
func (r *forwardInterceptor) resolveFromClient(
in *ForwardHtlcInterceptResponse) error {
circuitKey := channeldb.CircuitKey{
ChanID: lnwire.NewShortChanIDFromInt(in.IncomingCircuitKey.ChanId),
HtlcID: in.IncomingCircuitKey.HtlcId,
}
var interceptedForward htlcswitch.InterceptedForward
interceptedForward, ok := r.holdForwards[circuitKey]
if !ok {
return ErrFwdNotExists
}
delete(r.holdForwards, circuitKey)
switch in.Action {
case ResolveHoldForwardAction_RESUME:
return interceptedForward.Resume()
case ResolveHoldForwardAction_FAIL:
return interceptedForward.Fail()
case ResolveHoldForwardAction_SETTLE:
if in.Preimage == nil {
return ErrMissingPreimage
}
preimage, err := lntypes.MakePreimage(in.Preimage)
if err != nil {
return err
}
return interceptedForward.Settle(preimage)
default:
return fmt.Errorf("unrecognized resolve action %v", in.Action)
}
}
// onDisconnect removes all previousely held forwards from
// the store. Before they are removed it ensure to resume as the default
// behavior.
func (r *forwardInterceptor) onDisconnect() {
// Then close the channel so all go routine will exit.
close(r.quit)
log.Infof("RPC interceptor disconnected, resolving held packets")
for key, forward := range r.holdForwards {
if err := forward.Resume(); err != nil {
log.Errorf("failed to resume hold forward %v", err)
}
delete(r.holdForwards, key)
}
r.wg.Wait()
}

View File

@ -169,6 +169,34 @@ func (PaymentState) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{1}
}
type ResolveHoldForwardAction int32
const (
ResolveHoldForwardAction_SETTLE ResolveHoldForwardAction = 0
ResolveHoldForwardAction_FAIL ResolveHoldForwardAction = 1
ResolveHoldForwardAction_RESUME ResolveHoldForwardAction = 2
)
var ResolveHoldForwardAction_name = map[int32]string{
0: "SETTLE",
1: "FAIL",
2: "RESUME",
}
var ResolveHoldForwardAction_value = map[string]int32{
"SETTLE": 0,
"FAIL": 1,
"RESUME": 2,
}
func (x ResolveHoldForwardAction) String() string {
return proto.EnumName(ResolveHoldForwardAction_name, int32(x))
}
func (ResolveHoldForwardAction) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{2}
}
type HtlcEvent_EventType int32
const (
@ -1727,9 +1755,196 @@ func (m *PaymentStatus) GetHtlcs() []*lnrpc.HTLCAttempt {
return nil
}
type CircuitKey struct {
/// The id of the channel that the is part of this circuit.
ChanId uint64 `protobuf:"varint,1,opt,name=chan_id,json=chanId,proto3" json:"chan_id,omitempty"`
/// The index of the incoming htlc in the incoming channel.
HtlcId uint64 `protobuf:"varint,2,opt,name=htlc_id,json=htlcId,proto3" json:"htlc_id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CircuitKey) Reset() { *m = CircuitKey{} }
func (m *CircuitKey) String() string { return proto.CompactTextString(m) }
func (*CircuitKey) ProtoMessage() {}
func (*CircuitKey) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{24}
}
func (m *CircuitKey) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CircuitKey.Unmarshal(m, b)
}
func (m *CircuitKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CircuitKey.Marshal(b, m, deterministic)
}
func (m *CircuitKey) XXX_Merge(src proto.Message) {
xxx_messageInfo_CircuitKey.Merge(m, src)
}
func (m *CircuitKey) XXX_Size() int {
return xxx_messageInfo_CircuitKey.Size(m)
}
func (m *CircuitKey) XXX_DiscardUnknown() {
xxx_messageInfo_CircuitKey.DiscardUnknown(m)
}
var xxx_messageInfo_CircuitKey proto.InternalMessageInfo
func (m *CircuitKey) GetChanId() uint64 {
if m != nil {
return m.ChanId
}
return 0
}
func (m *CircuitKey) GetHtlcId() uint64 {
if m != nil {
return m.HtlcId
}
return 0
}
type ForwardHtlcInterceptRequest struct {
//
//The key of this forwarded htlc. It defines the incoming channel id and
//the index in this channel.
IncomingCircuitKey *CircuitKey `protobuf:"bytes,1,opt,name=incoming_circuit_key,json=incomingCircuitKey,proto3" json:"incoming_circuit_key,omitempty"`
//
//The htlc payment hash. This value is not guaranteed to be unique per
//request.
HtlcPaymentHash []byte `protobuf:"bytes,2,opt,name=htlc_payment_hash,json=htlcPaymentHash,proto3" json:"htlc_payment_hash,omitempty"`
/// The htlc amount.
AmountMsat uint64 `protobuf:"varint,3,opt,name=amount_msat,json=amountMsat,proto3" json:"amount_msat,omitempty"`
/// The htlc expiry.
Expiry uint32 `protobuf:"varint,4,opt,name=expiry,proto3" json:"expiry,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ForwardHtlcInterceptRequest) Reset() { *m = ForwardHtlcInterceptRequest{} }
func (m *ForwardHtlcInterceptRequest) String() string { return proto.CompactTextString(m) }
func (*ForwardHtlcInterceptRequest) ProtoMessage() {}
func (*ForwardHtlcInterceptRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{25}
}
func (m *ForwardHtlcInterceptRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ForwardHtlcInterceptRequest.Unmarshal(m, b)
}
func (m *ForwardHtlcInterceptRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ForwardHtlcInterceptRequest.Marshal(b, m, deterministic)
}
func (m *ForwardHtlcInterceptRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ForwardHtlcInterceptRequest.Merge(m, src)
}
func (m *ForwardHtlcInterceptRequest) XXX_Size() int {
return xxx_messageInfo_ForwardHtlcInterceptRequest.Size(m)
}
func (m *ForwardHtlcInterceptRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ForwardHtlcInterceptRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ForwardHtlcInterceptRequest proto.InternalMessageInfo
func (m *ForwardHtlcInterceptRequest) GetIncomingCircuitKey() *CircuitKey {
if m != nil {
return m.IncomingCircuitKey
}
return nil
}
func (m *ForwardHtlcInterceptRequest) GetHtlcPaymentHash() []byte {
if m != nil {
return m.HtlcPaymentHash
}
return nil
}
func (m *ForwardHtlcInterceptRequest) GetAmountMsat() uint64 {
if m != nil {
return m.AmountMsat
}
return 0
}
func (m *ForwardHtlcInterceptRequest) GetExpiry() uint32 {
if m != nil {
return m.Expiry
}
return 0
}
//*
//ForwardHtlcInterceptResponse enables the caller to resolve a previously hold forward.
//The caller can choose either to:
//- `Resume`: Execute the default behavior (usually forward).
//- `Reject`: Fail the htlc backwards.
//- `Settle`: Settle this htlc with a given preimage.
type ForwardHtlcInterceptResponse struct {
//*
//The key of this forwarded htlc. It defines the incoming channel id and
//the index in this channel.
IncomingCircuitKey *CircuitKey `protobuf:"bytes,1,opt,name=incoming_circuit_key,json=incomingCircuitKey,proto3" json:"incoming_circuit_key,omitempty"`
// The resolve action for this intercepted htlc.
Action ResolveHoldForwardAction `protobuf:"varint,2,opt,name=action,proto3,enum=routerrpc.ResolveHoldForwardAction" json:"action,omitempty"`
// The preimage in case the resolve action is Settle.
Preimage []byte `protobuf:"bytes,3,opt,name=preimage,proto3" json:"preimage,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ForwardHtlcInterceptResponse) Reset() { *m = ForwardHtlcInterceptResponse{} }
func (m *ForwardHtlcInterceptResponse) String() string { return proto.CompactTextString(m) }
func (*ForwardHtlcInterceptResponse) ProtoMessage() {}
func (*ForwardHtlcInterceptResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{26}
}
func (m *ForwardHtlcInterceptResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ForwardHtlcInterceptResponse.Unmarshal(m, b)
}
func (m *ForwardHtlcInterceptResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ForwardHtlcInterceptResponse.Marshal(b, m, deterministic)
}
func (m *ForwardHtlcInterceptResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ForwardHtlcInterceptResponse.Merge(m, src)
}
func (m *ForwardHtlcInterceptResponse) XXX_Size() int {
return xxx_messageInfo_ForwardHtlcInterceptResponse.Size(m)
}
func (m *ForwardHtlcInterceptResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ForwardHtlcInterceptResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ForwardHtlcInterceptResponse proto.InternalMessageInfo
func (m *ForwardHtlcInterceptResponse) GetIncomingCircuitKey() *CircuitKey {
if m != nil {
return m.IncomingCircuitKey
}
return nil
}
func (m *ForwardHtlcInterceptResponse) GetAction() ResolveHoldForwardAction {
if m != nil {
return m.Action
}
return ResolveHoldForwardAction_SETTLE
}
func (m *ForwardHtlcInterceptResponse) GetPreimage() []byte {
if m != nil {
return m.Preimage
}
return nil
}
func init() {
proto.RegisterEnum("routerrpc.FailureDetail", FailureDetail_name, FailureDetail_value)
proto.RegisterEnum("routerrpc.PaymentState", PaymentState_name, PaymentState_value)
proto.RegisterEnum("routerrpc.ResolveHoldForwardAction", ResolveHoldForwardAction_name, ResolveHoldForwardAction_value)
proto.RegisterEnum("routerrpc.HtlcEvent_EventType", HtlcEvent_EventType_name, HtlcEvent_EventType_value)
proto.RegisterType((*SendPaymentRequest)(nil), "routerrpc.SendPaymentRequest")
proto.RegisterMapType((map[uint64][]byte)(nil), "routerrpc.SendPaymentRequest.DestCustomRecordsEntry")
@ -1756,155 +1971,172 @@ func init() {
proto.RegisterType((*SettleEvent)(nil), "routerrpc.SettleEvent")
proto.RegisterType((*LinkFailEvent)(nil), "routerrpc.LinkFailEvent")
proto.RegisterType((*PaymentStatus)(nil), "routerrpc.PaymentStatus")
proto.RegisterType((*CircuitKey)(nil), "routerrpc.CircuitKey")
proto.RegisterType((*ForwardHtlcInterceptRequest)(nil), "routerrpc.ForwardHtlcInterceptRequest")
proto.RegisterType((*ForwardHtlcInterceptResponse)(nil), "routerrpc.ForwardHtlcInterceptResponse")
}
func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) }
var fileDescriptor_7a0613f69d37b0a5 = []byte{
// 2283 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0x5d, 0x73, 0xdb, 0xc6,
0xd5, 0x0e, 0x48, 0x50, 0x22, 0x0f, 0x3f, 0x04, 0x2d, 0x1d, 0x19, 0x2f, 0x15, 0x27, 0x0c, 0xde,
0xc4, 0xe1, 0xb8, 0x89, 0xe4, 0xa8, 0x9d, 0x36, 0xd3, 0x36, 0x69, 0x29, 0x12, 0x8a, 0x60, 0x53,
0x00, 0xb3, 0xa4, 0x64, 0xbb, 0xbe, 0xd8, 0x81, 0xc8, 0xa5, 0x88, 0x0a, 0x04, 0x58, 0x60, 0x69,
0x47, 0x97, 0xbd, 0xeb, 0xf4, 0x8f, 0xf4, 0xae, 0xbf, 0xa0, 0x3f, 0xa5, 0x33, 0xbd, 0xed, 0x7d,
0x67, 0x7a, 0xdd, 0xd9, 0xc5, 0x82, 0x02, 0x29, 0xca, 0x6e, 0x6f, 0x6c, 0xe2, 0x39, 0xcf, 0x9e,
0x3d, 0x67, 0xcf, 0xd7, 0xae, 0x60, 0x2f, 0x0a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
0x18, 0xea, 0x1b, 0x1e, 0x4e, 0x2b, 0xbb, 0xdc, 0xff, 0xec, 0x5a, 0xd9, 0xe5, 0x5d, 0xef, 0xaf,
0xd7, 0xa0, 0xad, 0xdf, 0xb3, 0x91, 0xb1, 0xbe, 0xf6, 0xee, 0x85, 0xbf, 0xf1, 0xff, 0xef, 0xe4,
0x48, 0xe5, 0x16, 0xc0, 0xed, 0x6d, 0x15, 0x7d, 0x94, 0x59, 0x72, 0xe7, 0xb6, 0xdd, 0x78, 0x74,
0x8f, 0x54, 0xaa, 0x1a, 0x42, 0x7d, 0xc3, 0xf5, 0x75, 0xe5, 0x34, 0xee, 0xbf, 0xde, 0x36, 0x1e,
0x6c, 0xba, 0xe5, 0x3d, 0x55, 0xd0, 0x59, 0x92, 0x60, 0xe9, 0xdf, 0x66, 0xde, 0x53, 0x31, 0xfa,
0xe6, 0x69, 0xb4, 0x88, 0x45, 0x6a, 0x3d, 0x55, 0x90, 0x03, 0x95, 0x6c, 0x95, 0xbc, 0xb7, 0x7c,
0xde, 0xa7, 0xf0, 0xf8, 0xeb, 0xdf, 0x1d, 0x5e, 0x79, 0x6c, 0xba, 0xb8, 0x3c, 0x18, 0x85, 0xb3,
0x43, 0xf1, 0x27, 0x91, 0xc0, 0x0b, 0xae, 0x02, 0xca, 0xde, 0x86, 0xd1, 0xf5, 0xa1, 0x1f, 0x8c,
0x0f, 0x45, 0x7a, 0x1e, 0x2e, 0xf5, 0x5c, 0x6e, 0x89, 0xbf, 0x88, 0xfe, 0xf4, 0x3f, 0x01, 0x00,
0x00, 0xff, 0xff, 0x77, 0xd4, 0x07, 0xd1, 0x41, 0x15, 0x00, 0x00,
// 2499 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4b, 0x73, 0x1b, 0xc7,
0xf1, 0xf7, 0xe2, 0x45, 0xa0, 0xf1, 0x5a, 0x0e, 0x64, 0x0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4, 0x79, 0xab, 0xc0, 0x19, 0x54, 0x13, 0xcd, 0xd8, 0x0f, 0xd0, 0xe3, 0xdb, 0x83, 0xc3, 0xd6,
0x7e, 0x9d, 0x88, 0x80, 0x37, 0x3c, 0x53, 0x5a, 0xda, 0x33, 0xed, 0xe8, 0xb3, 0x5f, 0x3f, 0xbd,
0x74, 0xd8, 0x7c, 0x75, 0x71, 0x30, 0xf1, 0x17, 0x4f, 0xc5, 0x2f, 0x71, 0x9e, 0xe3, 0x5d, 0x7a,
0x94, 0xbd, 0xf6, 0x83, 0xab, 0xa7, 0xae, 0x37, 0x7d, 0x2a, 0xd2, 0xe0, 0xe9, 0x5a, 0xe4, 0x45,
0x4e, 0xfc, 0x10, 0xff, 0x93, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x33, 0x56, 0x83, 0xe8, 0xb8,
0x17, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1975,6 +2207,13 @@ type RouterClient interface {
//Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
//the payment identified by the payment hash.
TrackPayment(ctx context.Context, in *TrackPaymentRequest, opts ...grpc.CallOption) (Router_TrackPaymentClient, error)
//*
//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.
HtlcInterceptor(ctx context.Context, opts ...grpc.CallOption) (Router_HtlcInterceptorClient, error)
}
type routerClient struct {
@ -2211,6 +2450,37 @@ func (x *routerTrackPaymentClient) Recv() (*PaymentStatus, error) {
return m, nil
}
func (c *routerClient) HtlcInterceptor(ctx context.Context, opts ...grpc.CallOption) (Router_HtlcInterceptorClient, error) {
stream, err := c.cc.NewStream(ctx, &_Router_serviceDesc.Streams[5], "/routerrpc.Router/HtlcInterceptor", opts...)
if err != nil {
return nil, err
}
x := &routerHtlcInterceptorClient{stream}
return x, nil
}
type Router_HtlcInterceptorClient interface {
Send(*ForwardHtlcInterceptResponse) error
Recv() (*ForwardHtlcInterceptRequest, error)
grpc.ClientStream
}
type routerHtlcInterceptorClient struct {
grpc.ClientStream
}
func (x *routerHtlcInterceptorClient) Send(m *ForwardHtlcInterceptResponse) error {
return x.ClientStream.SendMsg(m)
}
func (x *routerHtlcInterceptorClient) Recv() (*ForwardHtlcInterceptRequest, error) {
m := new(ForwardHtlcInterceptRequest)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// RouterServer is the server API for Router service.
type RouterServer interface {
//
@ -2269,6 +2539,13 @@ type RouterServer interface {
//Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
//the payment identified by the payment hash.
TrackPayment(*TrackPaymentRequest, Router_TrackPaymentServer) error
//*
//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.
HtlcInterceptor(Router_HtlcInterceptorServer) error
}
// UnimplementedRouterServer can be embedded to have forward compatible implementations.
@ -2311,6 +2588,9 @@ func (*UnimplementedRouterServer) SendPayment(req *SendPaymentRequest, srv Route
func (*UnimplementedRouterServer) TrackPayment(req *TrackPaymentRequest, srv Router_TrackPaymentServer) error {
return status.Errorf(codes.Unimplemented, "method TrackPayment not implemented")
}
func (*UnimplementedRouterServer) HtlcInterceptor(srv Router_HtlcInterceptorServer) error {
return status.Errorf(codes.Unimplemented, "method HtlcInterceptor not implemented")
}
func RegisterRouterServer(s *grpc.Server, srv RouterServer) {
s.RegisterService(&_Router_serviceDesc, srv)
@ -2547,6 +2827,32 @@ func (x *routerTrackPaymentServer) Send(m *PaymentStatus) error {
return x.ServerStream.SendMsg(m)
}
func _Router_HtlcInterceptor_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(RouterServer).HtlcInterceptor(&routerHtlcInterceptorServer{stream})
}
type Router_HtlcInterceptorServer interface {
Send(*ForwardHtlcInterceptRequest) error
Recv() (*ForwardHtlcInterceptResponse, error)
grpc.ServerStream
}
type routerHtlcInterceptorServer struct {
grpc.ServerStream
}
func (x *routerHtlcInterceptorServer) Send(m *ForwardHtlcInterceptRequest) error {
return x.ServerStream.SendMsg(m)
}
func (x *routerHtlcInterceptorServer) Recv() (*ForwardHtlcInterceptResponse, error) {
m := new(ForwardHtlcInterceptResponse)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
var _Router_serviceDesc = grpc.ServiceDesc{
ServiceName: "routerrpc.Router",
HandlerType: (*RouterServer)(nil),
@ -2606,6 +2912,12 @@ var _Router_serviceDesc = grpc.ServiceDesc{
Handler: _Router_TrackPayment_Handler,
ServerStreams: true,
},
{
StreamName: "HtlcInterceptor",
Handler: _Router_HtlcInterceptor_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "routerrpc/router.proto",
}

View File

@ -98,6 +98,15 @@ service Router {
rpc TrackPayment (TrackPaymentRequest) returns (stream PaymentStatus) {
option deprecated = true;
}
/**
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.
*/
rpc HtlcInterceptor (stream ForwardHtlcInterceptResponse) returns (stream ForwardHtlcInterceptRequest);
}
message SendPaymentRequest {
@ -579,3 +588,59 @@ message PaymentStatus {
*/
repeated lnrpc.HTLCAttempt htlcs = 4;
}
message CircuitKey {
/// The id of the channel that the is part of this circuit.
uint64 chan_id = 1;
/// The index of the incoming htlc in the incoming channel.
uint64 htlc_id = 2;
}
message ForwardHtlcInterceptRequest {
/*
The key of this forwarded htlc. It defines the incoming channel id and
the index in this channel.
*/
CircuitKey incoming_circuit_key = 1;
/*
The htlc payment hash. This value is not guaranteed to be unique per
request.
*/
bytes htlc_payment_hash = 2;
/// The htlc amount.
uint64 amount_msat = 3;
/// The htlc expiry.
uint32 expiry = 4;
}
/**
ForwardHtlcInterceptResponse enables the caller to resolve a previously hold forward.
The caller can choose either to:
- `Resume`: Execute the default behavior (usually forward).
- `Reject`: Fail the htlc backwards.
- `Settle`: Settle this htlc with a given preimage.
*/
message ForwardHtlcInterceptResponse {
/**
The key of this forwarded htlc. It defines the incoming channel id and
the index in this channel.
*/
CircuitKey incoming_circuit_key = 1;
// The resolve action for this intercepted htlc.
ResolveHoldForwardAction action = 2;
// The preimage in case the resolve action is Settle.
bytes preimage = 3;
}
enum ResolveHoldForwardAction {
SETTLE = 0;
FAIL = 1;
RESUME = 2;
}

View File

@ -844,6 +844,21 @@
}
}
},
"routerrpcCircuitKey": {
"type": "object",
"properties": {
"chan_id": {
"type": "string",
"format": "uint64",
"description": "/ The id of the channel that the is part of this circuit."
},
"htlc_id": {
"type": "string",
"format": "uint64",
"description": "/ The index of the incoming htlc in the incoming channel."
}
}
},
"routerrpcFailureDetail": {
"type": "string",
"enum": [
@ -885,6 +900,30 @@
"routerrpcForwardFailEvent": {
"type": "object"
},
"routerrpcForwardHtlcInterceptRequest": {
"type": "object",
"properties": {
"incoming_circuit_key": {
"$ref": "#/definitions/routerrpcCircuitKey",
"description": "The key of this forwarded htlc. It defines the incoming channel id and\nthe index in this channel."
},
"htlc_payment_hash": {
"type": "string",
"format": "byte",
"description": "The htlc payment hash. This value is not guaranteed to be unique per\nrequest."
},
"amount_msat": {
"type": "string",
"format": "uint64",
"description": "/ The htlc amount."
},
"expiry": {
"type": "integer",
"format": "int64",
"description": "/ The htlc expiry."
}
}
},
"routerrpcHtlcEvent": {
"type": "object",
"properties": {
@ -1110,6 +1149,15 @@
"routerrpcResetMissionControlResponse": {
"type": "object"
},
"routerrpcResolveHoldForwardAction": {
"type": "string",
"enum": [
"SETTLE",
"FAIL",
"RESUME"
],
"default": "SETTLE"
},
"routerrpcRouteFeeRequest": {
"type": "object",
"properties": {

View File

@ -70,6 +70,10 @@ type RouterBackend struct {
// SubscribeHtlcEvents returns a subscription client for the node's
// htlc events.
SubscribeHtlcEvents func() (*subscribe.Client, error)
// InterceptableForwarder exposes the ability to intercept forward events
// by letting the router register a ForwardInterceptor.
InterceptableForwarder htlcswitch.InterceptableHtlcForwarder
}
// MissionControl defines the mission control dependencies of routerrpc.

View File

@ -34,6 +34,11 @@ const (
var (
errServerShuttingDown = errors.New("routerrpc server shutting down")
// ErrInterceptorAlreadyExists is an error returned when the a new stream
// is opened and there is already one active interceptor.
// The user must disconnect prior to open another stream.
ErrInterceptorAlreadyExists = errors.New("interceptor already exists")
// macaroonOps are the set of capabilities that our minted macaroon (if
// it doesn't already exist) will have.
macaroonOps = []bakery.Op{
@ -97,6 +102,10 @@ var (
Entity: "offchain",
Action: "read",
}},
"/routerrpc.Router/HtlcInterceptor": {{
Entity: "offchain",
Action: "write",
}},
}
// DefaultRouterMacFilename is the default name of the router macaroon
@ -108,8 +117,9 @@ var (
// Server is a stand alone sub RPC server which exposes functionality that
// allows clients to route arbitrary payment through the Lightning Network.
type Server struct {
started int32 // To be used atomically.
shutdown int32 // To be used atomically.
started int32 // To be used atomically.
shutdown int32 // To be used atomically.
forwardInterceptorActive int32 // To be used atomically.
cfg *Config
@ -609,3 +619,22 @@ func (s *Server) SubscribeHtlcEvents(req *SubscribeHtlcEventsRequest,
}
}
}
// HtlcInterceptor is a bidirectional stream for streaming interception
// requests to the caller.
// Upon connection it does the following:
// 1. Check if there is already a live stream, if yes it rejects the request.
// 2. Regsitered a ForwardInterceptor
// 3. Delivers to the caller every √√ and detect his answer.
// It uses a local implementation of holdForwardsStore to keep all the hold
// forwards and find them when manual resolution is later needed.
func (s *Server) HtlcInterceptor(stream Router_HtlcInterceptorServer) error {
// We ensure there is only one interceptor at a time.
if !atomic.CompareAndSwapInt32(&s.forwardInterceptorActive, 0, 1) {
return ErrInterceptorAlreadyExists
}
defer atomic.CompareAndSwapInt32(&s.forwardInterceptorActive, 1, 0)
// run the forward interceptor.
return newForwardInterceptor(s, stream).run()
}

View File

@ -0,0 +1,387 @@
// +build rpctest
package itest
import (
"context"
"encoding/hex"
"fmt"
"sync"
"time"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/lightningnetwork/lnd"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
"github.com/lightningnetwork/lnd/lntest"
"github.com/lightningnetwork/lnd/routing/route"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type interceptorTestCase struct {
amountMsat int64
invoice *lnrpc.Invoice
shouldHold bool
interceptorAction routerrpc.ResolveHoldForwardAction
}
// testForwardInterceptor tests the forward interceptor RPC layer.
// The test creates a cluster of 3 connected nodes: Alice -> Bob -> Carol
// Alice sends 4 different payments to Carol while the interceptor handles
// differently the htlcs.
// The test ensures that:
// 1. Intercepted failed htlcs result in no payment (invoice is not settled).
// 2. Intercepted resumed htlcs result in a payment (invoice is settled).
// 3. Intercepted held htlcs result in no payment (invoice is not settled).
// 4. When Interceptor disconnects it resumes all held htlcs, which result in
// valid payment (invoice is settled).
func testForwardInterceptor(net *lntest.NetworkHarness, t *harnessTest) {
// initialize the test context with 3 connected nodes.
testContext := newInterceptorTestContext(t, net)
defer testContext.shutdownNodes()
const (
chanAmt = btcutil.Amount(300000)
)
// Open and wait for channels.
testContext.openChannel(testContext.alice, testContext.bob, chanAmt)
testContext.openChannel(testContext.bob, testContext.carol, chanAmt)
defer testContext.closeChannels()
testContext.waitForChannels()
// Connect the interceptor.
ctx := context.Background()
ctxt, cancelInterceptor := context.WithTimeout(ctx, defaultTimeout)
interceptor, err := testContext.bob.RouterClient.HtlcInterceptor(ctxt)
if err != nil {
t.Fatalf("failed to create HtlcInterceptor %v", err)
}
// Prepare the test cases.
testCases, err := testContext.prepareTestCases()
if err != nil {
t.Fatalf("failed to prepare test cases")
}
// A channel for the interceptor go routine to send the requested packets.
interceptedChan := make(chan *routerrpc.ForwardHtlcInterceptRequest,
len(testCases))
// Run the interceptor loop in its own go routine.
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
for {
request, err := interceptor.Recv()
if err != nil {
// If it is just the error result of the context cancellation
// the we exit silently.
status, ok := status.FromError(err)
if ok && status.Code() == codes.Canceled {
return
}
// Otherwise it an unexpected error, we fail the test.
t.t.Errorf("unexpected error in interceptor.Recv() %v", err)
return
}
interceptedChan <- request
}
}()
// For each test case make sure we initiate a payment from Alice to Carol
// routed through Bob. For each payment we also test its final status
// according to the interceptorAction specified in the test case.
wg.Add(1)
go func() {
defer wg.Done()
for _, tc := range testCases {
attempt, err := testContext.sendAliceToCarolPayment(
context.Background(), tc.invoice.ValueMsat, tc.invoice.RHash)
if t.t.Failed() {
return
}
if err != nil {
t.t.Errorf("failed to send payment %v", err)
}
switch tc.interceptorAction {
// For 'fail' interceptor action we make sure the payment failed.
case routerrpc.ResolveHoldForwardAction_FAIL:
if attempt.Status != lnrpc.HTLCAttempt_FAILED {
t.t.Errorf("expected payment to fail, instead got %v", attempt.Status)
}
// For settle and resume we make sure the payment is successfull.
case routerrpc.ResolveHoldForwardAction_SETTLE:
fallthrough
case routerrpc.ResolveHoldForwardAction_RESUME:
if attempt.Status != lnrpc.HTLCAttempt_SUCCEEDED {
t.t.Errorf("expected payment to succeed, instead got %v", attempt.Status)
}
}
}
}()
// We make sure here the interceptor has processed all packets before we
// check the payment statuses.
for i := 0; i < len(testCases); i++ {
select {
case request := <-interceptedChan:
testCase := testCases[i]
// For held packets we ignore, keeping them in hold status.
if testCase.shouldHold {
continue
}
// For all other packets we resolve according to the test case.
interceptor.Send(&routerrpc.ForwardHtlcInterceptResponse{
IncomingCircuitKey: request.IncomingCircuitKey,
Action: testCase.interceptorAction,
Preimage: testCase.invoice.RPreimage,
})
case <-time.After(defaultTimeout):
t.Fatalf("response from interceptor was not received %v", i)
}
}
// At this point we are left with the held packets, we want to make sure
// each one of them has a corresponding 'in-flight' payment at
// Alice's node.
payments, err := testContext.alice.ListPayments(context.Background(),
&lnrpc.ListPaymentsRequest{IncludeIncomplete: true})
if err != nil {
t.Fatalf("failed to fetch payments")
}
for _, testCase := range testCases {
if testCase.shouldHold {
hashStr := hex.EncodeToString(testCase.invoice.RHash)
var foundPayment *lnrpc.Payment
expectedAmt := testCase.invoice.ValueMsat
for _, p := range payments.Payments {
if p.PaymentHash == hashStr {
foundPayment = p
break
}
}
if foundPayment == nil {
t.Fatalf("expected to find pending payment for held"+
"htlc %v", hashStr)
}
if foundPayment.ValueMsat != expectedAmt ||
foundPayment.Status != lnrpc.Payment_IN_FLIGHT {
t.Fatalf("expected to find in flight payment for"+
"amount %v, %v", testCase.invoice.ValueMsat, foundPayment.Status)
}
}
}
// Disconnect interceptor should cause resume held packets.
// After that we wait for all go routines to finish, including the one
// that tests the payment final status for the held payment.
cancelInterceptor()
wg.Wait()
}
// interceptorTestContext is a helper struct to hold the test context and
// provide the needed functionality.
type interceptorTestContext struct {
t *harnessTest
net *lntest.NetworkHarness
// Keep a list of all our active channels.
networkChans []*lnrpc.ChannelPoint
closeChannelFuncs []func()
alice, bob, carol *lntest.HarnessNode
nodes []*lntest.HarnessNode
}
func newInterceptorTestContext(t *harnessTest,
net *lntest.NetworkHarness) *interceptorTestContext {
ctxb := context.Background()
// Create a three-node context consisting of Alice, Bob and Carol
carol, err := net.NewNode("carol", nil)
if err != nil {
t.Fatalf("unable to create carol: %v", err)
}
// Connect nodes
nodes := []*lntest.HarnessNode{net.Alice, net.Bob, carol}
for i := 0; i < len(nodes); i++ {
for j := i + 1; j < len(nodes); j++ {
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
if err := net.EnsureConnected(ctxt, nodes[i], nodes[j]); err != nil {
t.Fatalf("unable to connect nodes: %v", err)
}
}
}
ctx := interceptorTestContext{
t: t,
net: net,
alice: net.Alice,
bob: net.Bob,
carol: carol,
nodes: nodes,
}
return &ctx
}
// prepareTestCases prepares 4 tests:
// 1. failed htlc.
// 2. resumed htlc.
// 3. settling htlc externally.
// 4. held htlc that is resumed later.
func (c *interceptorTestContext) prepareTestCases() (
[]*interceptorTestCase, error) {
cases := []*interceptorTestCase{
&interceptorTestCase{amountMsat: 1000, shouldHold: false,
interceptorAction: routerrpc.ResolveHoldForwardAction_FAIL},
&interceptorTestCase{amountMsat: 1000, shouldHold: false,
interceptorAction: routerrpc.ResolveHoldForwardAction_RESUME},
&interceptorTestCase{amountMsat: 1000, shouldHold: false,
interceptorAction: routerrpc.ResolveHoldForwardAction_SETTLE},
&interceptorTestCase{amountMsat: 1000, shouldHold: true,
interceptorAction: routerrpc.ResolveHoldForwardAction_RESUME},
}
for _, t := range cases {
addResponse, err := c.carol.AddInvoice(context.Background(), &lnrpc.Invoice{
ValueMsat: t.amountMsat,
})
if err != nil {
return nil, fmt.Errorf("unable to add invoice: %v", err)
}
invoice, err := c.carol.LookupInvoice(context.Background(), &lnrpc.PaymentHash{
RHashStr: hex.EncodeToString(addResponse.RHash),
})
if err != nil {
return nil, fmt.Errorf("unable to add invoice: %v", err)
}
t.invoice = invoice
}
return cases, nil
}
func (c *interceptorTestContext) openChannel(from, to *lntest.HarnessNode, chanSize btcutil.Amount) {
ctxb := context.Background()
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
err := c.net.SendCoins(ctxt, btcutil.SatoshiPerBitcoin, from)
if err != nil {
c.t.Fatalf("unable to send coins : %v", err)
}
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
chanPoint := openChannelAndAssert(
ctxt, c.t, c.net, from, to,
lntest.OpenChannelParams{
Amt: chanSize,
},
)
c.closeChannelFuncs = append(c.closeChannelFuncs, func() {
ctxt, _ := context.WithTimeout(ctxb, channelCloseTimeout)
closeChannelAndAssert(
ctxt, c.t, c.net, from, chanPoint, false,
)
})
c.networkChans = append(c.networkChans, chanPoint)
}
func (c *interceptorTestContext) closeChannels() {
for _, f := range c.closeChannelFuncs {
f()
}
}
func (c *interceptorTestContext) shutdownNodes() {
shutdownAndAssert(c.net, c.t, c.carol)
}
func (c *interceptorTestContext) waitForChannels() {
ctxb := context.Background()
// Wait for all nodes to have seen all channels.
for _, chanPoint := range c.networkChans {
for _, node := range c.nodes {
txid, err := lnd.GetChanPointFundingTxid(chanPoint)
if err != nil {
c.t.Fatalf("unable to get txid: %v", err)
}
point := wire.OutPoint{
Hash: *txid,
Index: chanPoint.OutputIndex,
}
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
err = node.WaitForNetworkChannelOpen(ctxt, chanPoint)
if err != nil {
c.t.Fatalf("(%d): timeout waiting for "+
"channel(%s) open: %v",
node.NodeID, point, err)
}
}
}
}
// sendAliceToCarolPayment sends a payment from alice to carol and make an
// attempt to pay. The lnrpc.HTLCAttempt is returned.
func (c *interceptorTestContext) sendAliceToCarolPayment(ctx context.Context,
amtMsat int64, paymentHash []byte) (*lnrpc.HTLCAttempt, error) {
// Build a route from alice to carol.
route, err := c.buildRoute(ctx, amtMsat, []*lntest.HarnessNode{c.bob, c.carol})
if err != nil {
return nil, err
}
sendReq := &routerrpc.SendToRouteRequest{
PaymentHash: paymentHash,
Route: route,
}
// Send the payment.
return c.alice.RouterClient.SendToRouteV2(ctx, sendReq)
}
// buildRoute is a helper function to build a route with given hops.
func (c *interceptorTestContext) buildRoute(ctx context.Context, amtMsat int64, hops []*lntest.HarnessNode) (
*lnrpc.Route, error) {
rpcHops := make([][]byte, 0, len(hops))
for _, hop := range hops {
k := hop.PubKeyStr
pubkey, err := route.NewVertexFromStr(k)
if err != nil {
return nil, fmt.Errorf("error parsing %v: %v",
k, err)
}
rpcHops = append(rpcHops, pubkey[:])
}
req := &routerrpc.BuildRouteRequest{
AmtMsat: amtMsat,
FinalCltvDelta: lnd.DefaultBitcoinTimeLockDelta,
HopPubkeys: rpcHops,
}
routeResp, err := c.alice.RouterClient.BuildRoute(ctx, req)
if err != nil {
return nil, err
}
return routeResp.Route, nil
}

View File

@ -14669,6 +14669,10 @@ var testsCases = []*testCase{
name: "REST API",
test: testRestApi,
},
{
name: "intercept forwarded htlc packets",
test: testForwardInterceptor,
},
}
// TestLightningNetworkDaemon performs a series of integration tests amongst a

View File

@ -89,13 +89,13 @@
<time> [ERR] HSWC: ChannelLink(<chan>): unhandled error while forwarding htlc packet over htlcswitch: insufficient bandwidth to route htlc
<time> [ERR] HSWC: ChannelLink(<chan>): unhandled error while forwarding htlc packet over htlcswitch: node configured to disallow forwards
<time> [ERR] HSWC: ChannelLink(<chan>): unhandled error while forwarding htlc packet over htlcswitch: UnknownNextPeer
<time> [ERR] HSWC: ChannelLink(<chan>): failing link: unable to synchronize channel states: unable to send chan sync message for ChannelPoint(<chan_point>): set tcp <ip>: use of closed network connection with error: unable to resume channel, recovery required
<time> [ERR] HSWC: Unhandled error while reforwarding htlc settle/fail over htlcswitch: AmountBelowMinimum(amt=<amt>, update=(lnwire.ChannelUpdate) {
<time> [ERR] HSWC: Unhandled error while reforwarding htlc settle/fail over htlcswitch: circuit has already been closed
<time> [ERR] HSWC: Unhandled error while reforwarding htlc settle/fail over htlcswitch: FeeInsufficient(htlc_amt==<amt>, update=(lnwire.ChannelUpdate) {
<time> [ERR] HSWC: Unhandled error while reforwarding htlc settle/fail over htlcswitch: insufficient bandwidth to route htlc
<time> [ERR] HSWC: Unhandled error while reforwarding htlc settle/fail over htlcswitch: node configured to disallow forwards
<time> [ERR] HSWC: Unhandled error while reforwarding htlc settle/fail over htlcswitch: UnknownNextPeer
<time> [ERR] HSWC: ChannelLink(<chan>): failing link: unable to synchronize channel states: unable to send chan sync message for ChannelPoint(<chan_point>): set tcp <ip>: use of closed network connection with error: unable to resume channel, recovery required
<time> [ERR] HSWC: FeeInsufficient(htlc_amt==<amt>, update=(lnwire.ChannelUpdate) {
<time> [ERR] HSWC: insufficient bandwidth to route htlc
<time> [ERR] HSWC: Link <chan> not found
@ -190,3 +190,4 @@
<time> [ERR] FNDG: Unable to advance state(<chan_point>): failed adding to router graph: error sending channel announcement: gossiper is shutting down
<time> [ERR] PEER: unable to close channel, ChannelID(<hex>) is unknown
<time> [ERR] HSWC: ChannelLink(<chan>): unable to update signals
<time> [ERR] RPCS: [/routerrpc.Router/HtlcInterceptor]: rpc error: code = Canceled desc = context canceled

View File

@ -549,13 +549,14 @@ func newRPCServer(cfg *Config, s *server, macService *macaroons.Service,
return info.NodeKey1Bytes, info.NodeKey2Bytes, nil
},
FindRoute: s.chanRouter.FindRoute,
MissionControl: s.missionControl,
ActiveNetParams: activeNetParams.Params,
Tower: s.controlTower,
MaxTotalTimelock: cfg.MaxOutgoingCltvExpiry,
DefaultFinalCltvDelta: uint16(cfg.Bitcoin.TimeLockDelta),
SubscribeHtlcEvents: s.htlcNotifier.SubscribeHtlcEvents,
FindRoute: s.chanRouter.FindRoute,
MissionControl: s.missionControl,
ActiveNetParams: activeNetParams.Params,
Tower: s.controlTower,
MaxTotalTimelock: cfg.MaxOutgoingCltvExpiry,
DefaultFinalCltvDelta: uint16(cfg.Bitcoin.TimeLockDelta),
SubscribeHtlcEvents: s.htlcNotifier.SubscribeHtlcEvents,
InterceptableForwarder: s.interceptableSwitch,
}
genInvoiceFeatures := func() *lnwire.FeatureVector {