Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ require (
github.com/fortytw2/leaktest v1.3.0
github.com/golang-migrate/migrate/v4 v4.17.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0
github.com/jackc/pgconn v1.14.3
github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438
github.com/jackc/pgx/v5 v5.9.2
github.com/jessevdk/go-flags v1.4.0
github.com/lib/pq v1.10.9
github.com/lightninglabs/aperture v0.3.13-beta
github.com/lightninglabs/lndclient v0.20.0-8
github.com/lightninglabs/loop/looprpc v1.0.7
Expand All @@ -45,11 +43,15 @@ require (
modernc.org/sqlite v1.34.5
)

require (
github.com/jackc/pgconn v1.14.3 // indirect
github.com/lib/pq v1.10.9 // indirect
)

require (
dario.cat/mergo v1.0.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e // indirect
github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82 // indirect
Expand Down Expand Up @@ -132,7 +134,7 @@ require (
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240815225420-8b40adf04ab9 // indirect
github.com/lightningnetwork/lnd/fn/v2 v2.0.9 // indirect
github.com/lightningnetwork/lnd/healthcheck v1.2.6 // indirect
github.com/lightningnetwork/lnd/kvdb v1.4.16 // indirect
github.com/lightningnetwork/lnd/kvdb v1.5.1 // indirect
github.com/lightningnetwork/lnd/sqldb v1.0.12-0.20260113193010-8565d12e40b1 // indirect
github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand Down Expand Up @@ -242,4 +244,4 @@ replace gonum.org/v1/plot => github.com/gonum/plot v0.10.1
// checking later if the domain reappears and replace can be removed.
replace dario.cat/mergo => github.com/darccio/mergo v1.0.1

go 1.25.5
go 1.25.10
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,6 @@ github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e h1:n+DcnTNkQnHlwpsrHoQtkrJIO7CBx029fw6oR4vIob4=
Expand Down Expand Up @@ -1142,8 +1140,8 @@ github.com/lightningnetwork/lnd/fn/v2 v2.0.9 h1:ZytG4ltPac/sCyg1EJDn10RGzPIDJeye
github.com/lightningnetwork/lnd/fn/v2 v2.0.9/go.mod h1:aPUJHJ31S+Lgoo8I5SxDIjnmeCifqujaiTXKZqpav3w=
github.com/lightningnetwork/lnd/healthcheck v1.2.6 h1:1sWhqr93GdkWy4+6U7JxBfcyZIE78MhIHTJZfPx7qqI=
github.com/lightningnetwork/lnd/healthcheck v1.2.6/go.mod h1:Mu02um4CWY/zdTOvFje7WJgJcHyX2zq/FG3MhOAiGaQ=
github.com/lightningnetwork/lnd/kvdb v1.4.16 h1:9BZgWdDfjmHRHLS97cz39bVuBAqMc4/p3HX1xtUdbDI=
github.com/lightningnetwork/lnd/kvdb v1.4.16/go.mod h1:HW+bvwkxNaopkz3oIgBV6NEnV4jCEZCACFUcNg4xSjM=
github.com/lightningnetwork/lnd/kvdb v1.5.1 h1:OG5cDbqggxiCFKAJbSPw0PfQovi+0odCZAAU5r5b+ho=
github.com/lightningnetwork/lnd/kvdb v1.5.1/go.mod h1:5lubXYoXHDBWBYKmC+2we7qgkjjz0cEZ/5QSQkxQSec=
github.com/lightningnetwork/lnd/queue v1.1.1 h1:99ovBlpM9B0FRCGYJo6RSFDlt8/vOkQQZznVb18iNMI=
github.com/lightningnetwork/lnd/queue v1.1.1/go.mod h1:7A6nC1Qrm32FHuhx/mi1cieAiBZo5O6l8IBIoQxvkz4=
github.com/lightningnetwork/lnd/sqldb v1.0.12-0.20260113193010-8565d12e40b1 h1:PkEppKL17cZh0Dr9h/T9BEVJUbd/p2tjJ/x8ffG3R0M=
Expand Down
12 changes: 7 additions & 5 deletions loopdb/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import (
"time"

"github.com/btcsuite/btcd/chaincfg"
postgres_migrate "github.com/golang-migrate/migrate/v4/database/postgres"
pgx_migrate "github.com/golang-migrate/migrate/v4/database/pgx/v5"
_ "github.com/golang-migrate/migrate/v4/source/file"
_ "github.com/jackc/pgx/v5/stdlib"
"github.com/lightninglabs/loop/loopdb/sqlc"
"github.com/stretchr/testify/require"
)

const (
dsnTemplate = "postgres://%v:%v@%v:%d/%v?sslmode=%v"
pgxDriver = "pgx/v5"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The pgx/v5/stdlib driver registers itself under the name "pgx", not "pgx/v5". Using "pgx/v5" as the driver name in sql.Open will result in a runtime panic/error: sql: unknown driver "pgx/v5" (forgotten import?).\n\nPlease change the pgxDriver constant to "pgx" to ensure the driver can be correctly loaded.

Suggested change
pgxDriver = "pgx/v5"
pgxDriver = "pgx"

)

var (
Expand Down Expand Up @@ -86,7 +88,7 @@ func NewPostgresStore(cfg *PostgresConfig,

log.Infof("Using SQL database '%s'", cfg.DSN(true))

rawDb, err := sql.Open("pgx", cfg.DSN(false))
rawDb, err := sql.Open(pgxDriver, cfg.DSN(false))
if err != nil {
return nil, err
}
Expand All @@ -97,9 +99,9 @@ func NewPostgresStore(cfg *PostgresConfig,
// system.
//
// First, we'll need to open up a new migration instance for
// our current target database: sqlite.
driver, err := postgres_migrate.WithInstance(
rawDb, &postgres_migrate.Config{},
// our current target database: postgres.
driver, err := pgx_migrate.WithInstance(
rawDb, &pgx_migrate.Config{},
)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions loopdb/postgres_fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"
"time"

_ "github.com/lib/pq"
_ "github.com/jackc/pgx/v5/stdlib"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -86,7 +86,7 @@ func NewTestPgFixture(t *testing.T, expiry time.Duration) *TestPgFixture {

var testDB *sql.DB
err = pool.Retry(func() error {
testDB, err = sql.Open("postgres", databaseURL)
testDB, err = sql.Open(pgxDriver, databaseURL)
if err != nil {
return err
}
Expand Down Expand Up @@ -127,7 +127,7 @@ func (f *TestPgFixture) TearDown(t *testing.T) {

// ClearDB clears the database.
func (f *TestPgFixture) ClearDB(t *testing.T) {
dbConn, err := sql.Open("postgres", f.GetDSN())
dbConn, err := sql.Open(pgxDriver, f.GetDSN())
require.NoError(t, err)

_, err = dbConn.ExecContext(
Expand Down
2 changes: 1 addition & 1 deletion loopdb/sqlerrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"errors"
"fmt"

"github.com/jackc/pgconn"
"github.com/jackc/pgerrcode"
"github.com/jackc/pgx/v5/pgconn"
"modernc.org/sqlite"
sqlite3 "modernc.org/sqlite/lib"
)
Expand Down
6 changes: 2 additions & 4 deletions looprpc/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/lightninglabs/loop/looprpc

go 1.25.5
go 1.25.10

require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0
Expand Down Expand Up @@ -80,8 +80,6 @@ require (
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgtype v1.14.4 // indirect
github.com/jackc/pgx/v4 v4.18.3 // indirect
github.com/jackc/pgx/v5 v5.9.2 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jessevdk/go-flags v1.4.0 // indirect
Expand All @@ -98,7 +96,7 @@ require (
github.com/lightningnetwork/lnd/clock v1.1.1 // indirect
github.com/lightningnetwork/lnd/fn/v2 v2.0.9 // indirect
github.com/lightningnetwork/lnd/healthcheck v1.2.6 // indirect
github.com/lightningnetwork/lnd/kvdb v1.4.16 // indirect
github.com/lightningnetwork/lnd/kvdb v1.5.1 // indirect
github.com/lightningnetwork/lnd/queue v1.1.1 // indirect
github.com/lightningnetwork/lnd/sqldb v1.0.12-0.20260113193010-8565d12e40b1 // indirect
github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect
Expand Down
Loading
Loading