Skip to content

Commit 9520a39

Browse files
committed
chainrpc: return Unavailable while notifier starts
From v0.20.0-rc3 (commit c6f458e) onward the ChainNotifier sub-server may still be initialising when clients attempt to subscribe, currently resulting in a gRPC Unknown error with a plain-text message. Change the notifier RPC endpoints to return codes.Unavailable instead so clients can reliably interpret the condition as "retry later" and handle the startup lag without unstable string matching.
1 parent 096ab65 commit 9520a39

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lnrpc/chainrpc/chain_server.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
"github.com/lightningnetwork/lnd/lnrpc"
1919
"github.com/lightningnetwork/lnd/macaroons"
2020
"google.golang.org/grpc"
21+
"google.golang.org/grpc/codes"
22+
"google.golang.org/grpc/status"
2123
"gopkg.in/macaroon-bakery.v2/bakery"
2224
)
2325

@@ -84,8 +86,8 @@ var (
8486

8587
// ErrChainNotifierServerNotActive indicates that the chain notifier hasn't
8688
// finished the startup process.
87-
ErrChainNotifierServerNotActive = errors.New("chain notifier RPC is " +
88-
"still in the process of starting")
89+
ErrChainNotifierServerNotActive = status.Error(codes.Unavailable,
90+
"chain notifier RPC is still in the process of starting")
8991
)
9092

9193
// ServerShell is a shell struct holding a reference to the actual sub-server.

0 commit comments

Comments
 (0)