Skip to content

Commit

Permalink
make restakedFPConsumerIDs deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianElvis committed Jan 17, 2025
1 parent 4f76af7 commit a5c040a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions x/btcstaking/keeper/btc_delegations.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"context"
"fmt"
"slices"

"cosmossdk.io/store/prefix"
"github.com/btcsuite/btcd/chaincfg/chainhash"
Expand Down Expand Up @@ -284,6 +285,9 @@ func (k Keeper) restakedFPConsumerIDs(ctx context.Context, fpBTCPKs []bbn.BIP340
uniqueConsumerIDs = append(uniqueConsumerIDs, consumerID)
}

// Sort consumer IDs for deterministic ordering
slices.Sort(uniqueConsumerIDs)

return uniqueConsumerIDs, nil
}

Expand Down

0 comments on commit a5c040a

Please sign in to comment.