htlcswitch: face race condition in unit tests by returning invoice

In this commit we modify the primary InvoiceRegistry interface within
the package to instead return a direct value for LookupInvoice rather
than a pointer. This fixes an existing race condition wherein a caller
could modify or read the value of the returned invoice.
This commit is contained in:
Olaoluwa Osuntokun
2017-11-11 16:09:14 -08:00
parent 010815e280
commit b6f64932c2
7 changed files with 23 additions and 14 deletions

View File

@@ -2029,7 +2029,7 @@ func (r *rpcServer) LookupInvoice(ctx context.Context,
return spew.Sdump(invoice)
}))
rpcInvoice, err := createRPCInvoice(invoice)
rpcInvoice, err := createRPCInvoice(&invoice)
if err != nil {
return nil, err
}