server+lntest: extract ErrServerNotActive error

This commit is contained in:
Wilmer Paulino committed 2019-10-23 17:37:15 -04:00
1 parent fd906475dd
commit 955d143c1b
3 files changed
+14 -15

No files matched your search

+6 -12
View File
@@ -1257,8 +1257,7 @@ func (r *rpcServer) ConnectPeer(ctx context.Context,
// The server hasn't yet started, so it won't be able to service any of
// our requests, so we'll bail early here.
if !r.server.Started() {
return nil, fmt.Errorf("chain backend is still syncing, server " +
"not active yet")
return nil, ErrServerNotActive
}
if in.Addr == nil {
@@ -1311,8 +1310,7 @@ func (r *rpcServer) DisconnectPeer(ctx context.Context,
rpcsLog.Debugf("[disconnectpeer] from peer(%s)", in.PubKey)
if !r.server.Started() {
return nil, fmt.Errorf("chain backend is still syncing, server " +
"not active yet")
return nil, ErrServerNotActive
}
// First we'll validate the string passed in within the request to
@@ -1398,8 +1396,7 @@ func (r *rpcServer) OpenChannel(in *lnrpc.OpenChannelRequest,
in.LocalFundingAmount, in.PushSat)
if !r.server.Started() {
return fmt.Errorf("chain backend is still syncing, server " +
"not active yet")
return ErrServerNotActive
}
localFundingAmt := btcutil.Amount(in.LocalFundingAmount)
@@ -1558,8 +1555,7 @@ func (r *rpcServer) OpenChannelSync(ctx context.Context,
// syncing, as otherwise we may not be able to obtain the relevant
// notifications.
if !r.server.Started() {
return nil, fmt.Errorf("chain backend is still syncing, server " +
"not active yet")
return nil, ErrServerNotActive
}
// Creation of channels before the wallet syncs up is currently
@@ -3205,8 +3201,7 @@ func (r *rpcServer) sendPayment(stream *paymentStream) error {
// syncing as we may be trying to sent a payment over a "stale"
// channel.
if !r.server.Started() {
return fmt.Errorf("chain backend is still syncing, server " +
"not active yet")
return ErrServerNotActive
}
// TODO(roasbeef): check payment filter to see if already used?
@@ -3396,8 +3391,7 @@ func (r *rpcServer) sendPaymentSync(ctx context.Context,
// syncing as we may be trying to sent a payment over a "stale"
// channel.
if !r.server.Started() {
return nil, fmt.Errorf("chain backend is still syncing, server " +
"not active yet")
return nil, ErrServerNotActive
}
// First we'll attempt to map the proto describing the next payment to