From 0d20abaac1267cae050e482cc6b65101d5f54f40 Mon Sep 17 00:00:00 2001 From: Gurjot Date: Tue, 29 Oct 2024 17:43:27 +0400 Subject: [PATCH] fix --- internal/db/interface.go | 8 ++++---- ...cessed_bbn_height.go => last_processed_height.go} | 4 ++-- tests/mocks/mock_db_client.go | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) rename internal/db/{last_processed_bbn_height.go => last_processed_height.go} (86%) diff --git a/internal/db/interface.go b/internal/db/interface.go index 4c7bce8..84a0a01 100644 --- a/internal/db/interface.go +++ b/internal/db/interface.go @@ -140,16 +140,16 @@ type DbInterface interface { */ DeleteExpiredDelegation(ctx context.Context, stakingTxHashHex string) error /** - * GetLastProcessedHeight retrieves the last processed height. + * GetLastProcessedBbnHeight retrieves the last processed BBN height. * @param ctx The context * @return The last processed height or an error */ - GetLastProcessedBBNHeight(ctx context.Context) (uint64, error) + GetLastProcessedBbnHeight(ctx context.Context) (uint64, error) /** - * UpdateLastProcessedBBNHeight updates the last processed BBN height. + * UpdateLastProcessedBbnHeight updates the last processed BBN height. * @param ctx The context * @param height The last processed height * @return An error if the operation failed */ - UpdateLastProcessedBBNHeight(ctx context.Context, height uint64) error + UpdateLastProcessedBbnHeight(ctx context.Context, height uint64) error } diff --git a/internal/db/last_processed_bbn_height.go b/internal/db/last_processed_height.go similarity index 86% rename from internal/db/last_processed_bbn_height.go rename to internal/db/last_processed_height.go index 2cee545..8442d97 100644 --- a/internal/db/last_processed_bbn_height.go +++ b/internal/db/last_processed_height.go @@ -9,7 +9,7 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" ) -func (db *Database) GetLastProcessedBBNHeight(ctx context.Context) (uint64, error) { +func (db *Database) GetLastProcessedBbnHeight(ctx context.Context) (uint64, error) { var result model.LastProcessedHeight err := db.client.Database(db.dbName). Collection(model.LastProcessedHeightCollection). @@ -24,7 +24,7 @@ func (db *Database) GetLastProcessedBBNHeight(ctx context.Context) (uint64, erro return result.Height, nil } -func (db *Database) UpdateLastProcessedBBNHeight(ctx context.Context, height uint64) error { +func (db *Database) UpdateLastProcessedBbnHeight(ctx context.Context, height uint64) error { update := bson.M{"$set": bson.M{"height": height}} opts := options.Update().SetUpsert(true) _, err := db.client.Database(db.dbName). diff --git a/tests/mocks/mock_db_client.go b/tests/mocks/mock_db_client.go index ddc2ed3..125ef5c 100644 --- a/tests/mocks/mock_db_client.go +++ b/tests/mocks/mock_db_client.go @@ -129,12 +129,12 @@ func (_m *DbInterface) GetFinalityProviderByBtcPk(ctx context.Context, btcPk str return r0, r1 } -// GetLastProcessedBBNHeight provides a mock function with given fields: ctx -func (_m *DbInterface) GetLastProcessedBBNHeight(ctx context.Context) (uint64, error) { +// GetLastProcessedBbnHeight provides a mock function with given fields: ctx +func (_m *DbInterface) GetLastProcessedBbnHeight(ctx context.Context) (uint64, error) { ret := _m.Called(ctx) if len(ret) == 0 { - panic("no return value specified for GetLastProcessedBBNHeight") + panic("no return value specified for GetLastProcessedBbnHeight") } var r0 uint64 @@ -337,12 +337,12 @@ func (_m *DbInterface) UpdateFinalityProviderState(ctx context.Context, btcPk st return r0 } -// UpdateLastProcessedBBNHeight provides a mock function with given fields: ctx, height -func (_m *DbInterface) UpdateLastProcessedBBNHeight(ctx context.Context, height uint64) error { +// UpdateLastProcessedBbnHeight provides a mock function with given fields: ctx, height +func (_m *DbInterface) UpdateLastProcessedBbnHeight(ctx context.Context, height uint64) error { ret := _m.Called(ctx, height) if len(ret) == 0 { - panic("no return value specified for UpdateLastProcessedBBNHeight") + panic("no return value specified for UpdateLastProcessedBbnHeight") } var r0 error