-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(x/staking): migrate
ValidatorByConsAddr
key to collections (…
- Loading branch information
Showing
6 changed files
with
46 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
package v2 | ||
|
||
import "strconv" | ||
import ( | ||
"strconv" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/address" | ||
) | ||
|
||
const ( | ||
// ModuleName is the name of the module | ||
ModuleName = "staking" | ||
) | ||
|
||
var HistoricalInfoKey = []byte{0x50} // prefix for the historical info | ||
var ( | ||
ValidatorsByConsAddrKey = []byte{0x22} // prefix for validators by consensus address | ||
HistoricalInfoKey = []byte{0x50} // prefix for the historical info | ||
) | ||
|
||
// GetHistoricalInfoKey returns a key prefix for indexing HistoricalInfo objects. | ||
func GetHistoricalInfoKey(height int64) []byte { | ||
return append(HistoricalInfoKey, []byte(strconv.FormatInt(height, 10))...) | ||
} | ||
|
||
// GetValidatorByConsAddrKey creates the key for the validator with pubkey | ||
// VALUE: validator operator address ([]byte) | ||
func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte { | ||
return append(ValidatorsByConsAddrKey, address.MustLengthPrefix(addr)...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters