mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 07:35:07 +02:00
invoices: ensure synchronous access to NewTestSqliteDB
Add a temporary mutex around the calls to sqldb.NewTestSqliteDB to ensure that only a single thread can access it at a time. This is a temporary work around that can be removed once this race condition in the sqlite repo has been resolved: https://gitlab.com/cznic/sqlite/-/issues/180
This commit is contained in:
@@ -234,7 +234,9 @@ func TestInvoices(t *testing.T) {
|
||||
makeSQLDB := func(t *testing.T, sqlite bool) invpkg.InvoiceDB {
|
||||
var db *sqldb.BaseDB
|
||||
if sqlite {
|
||||
sqliteConstructorMu.Lock()
|
||||
db = sqldb.NewTestSqliteDB(t).BaseDB
|
||||
sqliteConstructorMu.Unlock()
|
||||
} else {
|
||||
db = sqldb.NewTestPostgresDB(t, pgFixture).BaseDB
|
||||
}
|
||||
|
Reference in New Issue
Block a user