rpcserver: ensure server has started before CloseChannel
We do this as a general sanity check to ensure channels cannot be closed while either the backend is still syncing or the server is still starting.
This commit is contained in:
1 file changed
+4
@@ -1698,6 +1698,10 @@ func GetChanPointFundingTxid(chanPoint *lnrpc.ChannelPoint) (*chainhash.Hash, er
|
|||||||
func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
|
func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
|
||||||
updateStream lnrpc.Lightning_CloseChannelServer) error {
|
updateStream lnrpc.Lightning_CloseChannelServer) error {
|
||||||
|
|
||||||
|
if !r.server.Started() {
|
||||||
|
return ErrServerNotActive
|
||||||
|
}
|
||||||
|
|
||||||
// If the user didn't specify a channel point, then we'll reject this
|
// If the user didn't specify a channel point, then we'll reject this
|
||||||
// request all together.
|
// request all together.
|
||||||
if in.GetChannelPoint() == nil {
|
if in.GetChannelPoint() == nil {
|
||||||
|
|||||||
Reference in new issue
Block a user