rpcserver: add compile time interface assertion

This commit is contained in:
Olaoluwa Osuntokun 2015-12-29 17:21:42 -06:00
parent 02aa54f127
commit 0620580937

View File

@ -6,7 +6,6 @@ import (
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwallet/waddrmgr" "github.com/btcsuite/btcwallet/waddrmgr"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc"
"li.lan/labs/plasma/lnwallet" "li.lan/labs/plasma/lnwallet"
"li.lan/labs/plasma/rpcprotos" "li.lan/labs/plasma/rpcprotos"
) )
@ -20,14 +19,15 @@ type rpcServer struct {
lnwallet *lnwallet.LightningWallet lnwallet *lnwallet.LightningWallet
} }
var _ lnrpc.LightningServer = (*rpcServer)(nil)
// newRpcServer... // newRpcServer...
func newRpcServer(wallet *lnwallet.LightningWallet) *rpcServer { func newRpcServer(wallet *lnwallet.LightningWallet) *rpcServer {
return &rpcServer{wallet} return &rpcServer{wallet}
} }
// SendMany... // SendMany...
func (r *rpcServer) SendMany(ctx context.Context, in *lnrpc.SendManyRequest, func (r *rpcServer) SendMany(ctx context.Context, in *lnrpc.SendManyRequest) (*lnrpc.SendManyResponse, error) {
opts ...grpc.CallOption) (*lnrpc.SendManyResponse, error) {
sendMap := make(map[string]btcutil.Amount) sendMap := make(map[string]btcutil.Amount)
for addr, amt := range in.AddrToAmount { for addr, amt := range in.AddrToAmount {
@ -43,8 +43,7 @@ func (r *rpcServer) SendMany(ctx context.Context, in *lnrpc.SendManyRequest,
} }
// NewAddress... // NewAddress...
func (r *rpcServer) NewAddress(ctx context.Context, in *lnrpc.NewAddressRequest, func (r *rpcServer) NewAddress(ctx context.Context, in *lnrpc.NewAddressRequest) (*lnrpc.NewAddressResponse, error) {
opts ...grpc.CallOption) (*lnrpc.NewAddressResponse, error) {
r.lnwallet.KeyGenMtx.Lock() r.lnwallet.KeyGenMtx.Lock()
defer r.lnwallet.KeyGenMtx.Unlock() defer r.lnwallet.KeyGenMtx.Unlock()