diff --git a/lnrpc/routerrpc/router_backend.go b/lnrpc/routerrpc/router_backend.go index 7fab7354..6f06890f 100644 --- a/lnrpc/routerrpc/router_backend.go +++ b/lnrpc/routerrpc/router_backend.go @@ -9,8 +9,8 @@ import ( "time" "github.com/btcsuite/btcd/btcec" - "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/htlcswitch" @@ -83,6 +83,16 @@ type RouterBackend struct { // InterceptableForwarder exposes the ability to intercept forward events // by letting the router register a ForwardInterceptor. InterceptableForwarder htlcswitch.InterceptableHtlcForwarder + + // SetChannelEnabled exposes the ability to manually enable a channel. + SetChannelEnabled func(wire.OutPoint) error + + // SetChannelDisabled exposes the ability to manually disable a channel + SetChannelDisabled func(wire.OutPoint) error + + // SetChannelAuto exposes the ability to restore automatic channel state + // management after manually setting channel status. + SetChannelAuto func(wire.OutPoint) error } // MissionControl defines the mission control dependencies of routerrpc. diff --git a/rpcserver.go b/rpcserver.go index d8883351..ea3fc8a0 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -602,6 +602,13 @@ func newRPCServer(cfg *Config, s *server, macService *macaroons.Service, DefaultFinalCltvDelta: uint16(cfg.Bitcoin.TimeLockDelta), SubscribeHtlcEvents: s.htlcNotifier.SubscribeHtlcEvents, InterceptableForwarder: s.interceptableSwitch, + SetChannelEnabled: func(outpoint wire.OutPoint) error { + return s.chanStatusMgr.RequestEnable(outpoint, true) + }, + SetChannelDisabled: func(outpoint wire.OutPoint) error { + return s.chanStatusMgr.RequestDisable(outpoint, true) + }, + SetChannelAuto: s.chanStatusMgr.RequestAuto, } genInvoiceFeatures := func() *lnwire.FeatureVector {