lntypes: return a value from constructors

Returning pointers proved inconvenient in almost all cases. This commmit
converts the constructors to returning values.
This commit is contained in:
Joost Jager committed 2019-03-15 10:08:38 +01:00
1 parent 449c3d533e
commit c4263e7061
2 files changed
+13 -13

No files matched your search

+4 -4
View File
@@ -163,12 +163,12 @@ func (s *Server) RegisterWithRootServer(grpcServer *grpc.Server) error {
func (s *Server) SubscribeSingleInvoice(req *lnrpc.PaymentHash,
updateStream Invoices_SubscribeSingleInvoiceServer) error {
hash, err := lntypes.NewHash(req.RHash)
hash, err := lntypes.MakeHash(req.RHash)
if err != nil {
return err
}
invoiceClient := s.cfg.InvoiceRegistry.SubscribeSingleInvoice(*hash)
invoiceClient := s.cfg.InvoiceRegistry.SubscribeSingleInvoice(hash)
defer invoiceClient.Cancel()
for {
@@ -197,12 +197,12 @@ func (s *Server) SubscribeSingleInvoice(req *lnrpc.PaymentHash,
func (s *Server) CancelInvoice(ctx context.Context,
in *CancelInvoiceMsg) (*CancelInvoiceResp, error) {
paymentHash, err := lntypes.NewHash(in.PaymentHash)
paymentHash, err := lntypes.MakeHash(in.PaymentHash)
if err != nil {
return nil, err
}
err = s.cfg.InvoiceRegistry.CancelInvoice(*paymentHash)
err = s.cfg.InvoiceRegistry.CancelInvoice(paymentHash)
if err != nil {
return nil, err
}