From 45e3e8a6ab1cb6c2b2224a76b24a0c6517bacedf Mon Sep 17 00:00:00 2001 From: Ragot Geoffrey Date: Mon, 11 Sep 2023 13:36:30 +0200 Subject: [PATCH] fix: segments matching (#458) * fix: segments matching --- pkg/storage/sqlstorage/balances_test.go | 8 ++++++++ pkg/storage/sqlstorage/transactions.go | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/storage/sqlstorage/balances_test.go b/pkg/storage/sqlstorage/balances_test.go index 4966aa17f..956cbfefa 100644 --- a/pkg/storage/sqlstorage/balances_test.go +++ b/pkg/storage/sqlstorage/balances_test.go @@ -2,6 +2,8 @@ package sqlstorage_test import ( "context" + "github.com/numary/ledger/pkg/ledgertesting" + "os" "testing" "time" @@ -173,6 +175,12 @@ func testGetBalancesAggregated(t *testing.T, store *sqlstorage.Store) { } func testGetBalancesBigInts(t *testing.T, store *sqlstorage.Store) { + + if os.Getenv("NUMARY_STORAGE_POSTGRES_CONN_STRING") != "" || + ledgertesting.StorageDriverName() != "postgres" { + return + } + amount, _ := core.ParseMonetaryInt("5522360000000000000000") var txBigInts = core.ExpandedTransaction{ Transaction: core.Transaction{ diff --git a/pkg/storage/sqlstorage/transactions.go b/pkg/storage/sqlstorage/transactions.go index b9865dd0b..386e8d0f5 100644 --- a/pkg/storage/sqlstorage/transactions.go +++ b/pkg/storage/sqlstorage/transactions.go @@ -20,7 +20,7 @@ import ( // this regexp is used to distinguish between deprecated regex queries for // source, destination and account params and the new wildcard query // which allows segmented address pattern matching, e.g; "foo:bar:*" -var addressQueryRegexp = regexp.MustCompile(`^(\w+|\*|\.\*)(:(\w+|\*|\.\*))*$`) +var addressQueryRegexp = regexp.MustCompile(`^(\w+|\*|\.\*)(:(\w+|\*|\.\*)?)*$`) func (s *Store) buildTransactionsQuery(flavor Flavor, p ledger.TransactionsQuery) (*sqlbuilder.SelectBuilder, TxsPaginationToken) { sb := sqlbuilder.NewSelectBuilder()