Skip to content

Commit

Permalink
rm method
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 committed Nov 16, 2024
1 parent bd81d5b commit 4c7a78c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 70 deletions.
31 changes: 0 additions & 31 deletions internal/db/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,37 +137,6 @@ func (db *Database) GetBTCDelegationByStakingTxHash(
return &delegationDoc, nil
}

func (db *Database) GetBTCDelegationsByFinalityProviderPk(
ctx context.Context,
fpBtcPkHex string,
) ([]*model.BTCDelegationDetails, error) {
filter := bson.M{
"finality_provider_btc_pks_hex": fpBtcPkHex,
}

cursor, err := db.client.Database(db.dbName).
Collection(model.BTCDelegationDetailsCollection).
Find(ctx, filter)
if err != nil {
return nil, fmt.Errorf("failed to find delegations: %w", err)
}
defer cursor.Close(ctx)

var delegations []*model.BTCDelegationDetails
if err := cursor.All(ctx, &delegations); err != nil {
return nil, fmt.Errorf("failed to decode delegations: %w", err)
}

if len(delegations) == 0 {
return nil, &NotFoundError{
Key: fpBtcPkHex,
Message: "no BTC delegations found for finality provider public key",
}
}

return delegations, nil
}

func (db *Database) UpdateDelegationsStateByFinalityProvider(
ctx context.Context,
fpBTCPKHex string,
Expand Down
9 changes: 0 additions & 9 deletions internal/db/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,6 @@ type DbInterface interface {
GetBTCDelegationByStakingTxHash(
ctx context.Context, stakingTxHash string,
) (*model.BTCDelegationDetails, error)
/**
* GetBTCDelegationsByFinalityProviderPk retrieves the BTC delegations by the finality provider public key.
* @param ctx The context
* @param fpBtcPkHex The finality provider public key
* @return The BTC delegations or an error
*/
GetBTCDelegationsByFinalityProviderPk(
ctx context.Context, fpBtcPkHex string,
) ([]*model.BTCDelegationDetails, error)
/**
* UpdateDelegationsStateByFinalityProvider updates the BTC delegation state by the finality provider public key.
* @param ctx The context
Expand Down
30 changes: 0 additions & 30 deletions tests/mocks/mock_db_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4c7a78c

Please sign in to comment.