-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add pagination to queryDelegationsWithStatus #96
base: main
Are you sure you want to change the base?
Conversation
…o covenant, also added address to covenant key chain info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Minor comments
func (bc *BabylonController) QueryPendingDelegations(limit uint64, filter FilterFn) ([]*types.Delegation, error) { | ||
return bc.queryDelegationsWithStatus(btcstakingtypes.BTCDelegationStatus_PENDING, limit, filter) | ||
} | ||
|
||
func (bc *BabylonController) QueryActiveDelegations(limit uint64) ([]*types.Delegation, error) { | ||
return bc.queryDelegationsWithStatus(btcstakingtypes.BTCDelegationStatus_ACTIVE, limit) | ||
return bc.queryDelegationsWithStatus(btcstakingtypes.BTCDelegationStatus_ACTIVE, limit, nil) | ||
} | ||
|
||
func (bc *BabylonController) QueryVerifiedDelegations(limit uint64) ([]*types.Delegation, error) { | ||
return bc.queryDelegationsWithStatus(btcstakingtypes.BTCDelegationStatus_VERIFIED, limit) | ||
return bc.queryDelegationsWithStatus(btcstakingtypes.BTCDelegationStatus_VERIFIED, limit, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like this can be one function QueryDelegations(limit uint64, status btcstakingtypes.BTCDelegationStatus, filter FilterFn)
// amtSatFirst := btcutil.Amount(100) | ||
// amtSatSecond := btcutil.Amount(150) | ||
// amtSatThird := btcutil.Amount(200) | ||
// lastUnsanitizedDels := []*types.Delegation{ | ||
// &types.Delegation{ | ||
// ParamsVersion: pVersionWithCovenant, | ||
// TotalSat: amtSatFirst, | ||
// }, | ||
// delNoCovenant, | ||
// &types.Delegation{ | ||
// ParamsVersion: pVersionWithCovenant, | ||
// TotalSat: amtSatSecond, | ||
// }, | ||
// delNoCovenant, | ||
// &types.Delegation{ | ||
// ParamsVersion: pVersionWithCovenant, | ||
// TotalSat: amtSatThird, | ||
// }, | ||
// } | ||
|
||
// sanitizedDels, err := covenant.SanitizeDelegations(covKeyPair.PublicKey, paramsGet, lastUnsanitizedDels) | ||
// require.NoError(t, err) | ||
// require.Len(t, sanitizedDels, 3) | ||
// require.Equal(t, amtSatFirst, sanitizedDels[0].TotalSat) | ||
// require.Equal(t, amtSatSecond, sanitizedDels[1].TotalSat) | ||
// require.Equal(t, amtSatThird, sanitizedDels[2].TotalSat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove leftover code
The query should loop by the max limit set in the config
delegationlimit
, since the BTC delegations already signed and the ones in which the covenant pub key was not constructed with are being removed by sanitizeDelegationsCloses: #92