Skip to content

Commit

Permalink
iterate from sequence using start key
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-cha committed Dec 10, 2024
1 parent b0cfbc0 commit 4822c98
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions executor/child/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,9 @@ func SaveWithdrawal(db types.BasicDB, data executortypes.WithdrawalData) error {

// DeleteFutureWithdrawals deletes all future withdrawals from the database starting from the given sequence
func DeleteFutureWithdrawals(db types.DB, fromSequence uint64) error {
return db.Iterate(dbtypes.AppendSplitter(executortypes.WithdrawalSequencePrefix), nil, func(key, value []byte) (bool, error) {
sequence, err := executortypes.ParseWithdrawalSequenceKey(key)
if err != nil {
return true, err
}

if sequence < fromSequence {
return false, nil
}

return db.Iterate(dbtypes.AppendSplitter(executortypes.WithdrawalSequencePrefix), executortypes.PrefixedWithdrawalSequence(fromSequence), func(key, value []byte) (bool, error) {
data := executortypes.WithdrawalData{}
err = data.Unmarshal(value)
err := data.Unmarshal(value)
if err != nil {
return true, err
}
Expand Down

0 comments on commit 4822c98

Please sign in to comment.