mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-21 17:20:03 +02:00
lnd: implement new Quiesce RPC with link operation stub
This commit is contained in:
parent
99f5ca4018
commit
a085b59814
@ -6,6 +6,7 @@ package devrpc
|
|||||||
import (
|
import (
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
|
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is the primary configuration struct for the DEV RPC server. It
|
// Config is the primary configuration struct for the DEV RPC server. It
|
||||||
@ -16,4 +17,5 @@ import (
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
ActiveNetParams *chaincfg.Params
|
ActiveNetParams *chaincfg.Params
|
||||||
GraphDB *channeldb.ChannelGraph
|
GraphDB *channeldb.ChannelGraph
|
||||||
|
Switch *htlcswitch.Switch
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,10 @@ var (
|
|||||||
Entity: "offchain",
|
Entity: "offchain",
|
||||||
Action: "write",
|
Action: "write",
|
||||||
}},
|
}},
|
||||||
|
"/devrpc.Dev/Quiesce": {{
|
||||||
|
Entity: "offchain",
|
||||||
|
Action: "write",
|
||||||
|
}},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -342,3 +346,25 @@ func (s *Server) ImportGraph(ctx context.Context,
|
|||||||
|
|
||||||
return &ImportGraphResponse{}, nil
|
return &ImportGraphResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Quiesce initiates the quiescence process for the channel with the given
|
||||||
|
// channel ID. This method will block until the channel is fully quiesced.
|
||||||
|
func (s *Server) Quiesce(_ context.Context, in *QuiescenceRequest) (
|
||||||
|
*QuiescenceResponse, error) {
|
||||||
|
|
||||||
|
txid, err := lnrpc.GetChanPointFundingTxid(in.ChanId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
op := wire.NewOutPoint(txid, in.ChanId.OutputIndex)
|
||||||
|
cid := lnwire.NewChanIDFromOutPoint(*op)
|
||||||
|
_, err = s.cfg.Switch.GetLink(cid)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(proofofkeags): Add Link operation for initiating quiescence and
|
||||||
|
// implement the rest of this in those terms
|
||||||
|
return nil, fmt.Errorf("TODO(proofofkeags): Implement")
|
||||||
|
}
|
||||||
|
@ -346,6 +346,10 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
|
|||||||
reflect.ValueOf(graphDB),
|
reflect.ValueOf(graphDB),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
subCfgValue.FieldByName("Switch").Set(
|
||||||
|
reflect.ValueOf(htlcSwitch),
|
||||||
|
)
|
||||||
|
|
||||||
case *peersrpc.Config:
|
case *peersrpc.Config:
|
||||||
subCfgValue := extractReflectValue(subCfg)
|
subCfgValue := extractReflectValue(subCfg)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user