routerrpc: expose SetChannel* methods from Router backend
Allow router RPC requests to call into the ChanStatusManager to manually update channel state.
This commit is contained in:
parent
4e4f4bc194
commit
db76b970ac
@ -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.
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user