mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 05:46:32 +00:00
keymigrate: fix decoding of block-hash row keys (#8294)
This commit is contained in:
@@ -138,12 +138,16 @@ func migrateKey(key keyID) (keyID, error) {
|
||||
|
||||
return orderedcode.Append(nil, int64(3), int64(val))
|
||||
case bytes.HasPrefix(key, keyID("BH:")):
|
||||
val, err := strconv.Atoi(string(key[3:]))
|
||||
hash := string(key[3:])
|
||||
if len(hash)%2 == 1 {
|
||||
hash = "0" + hash
|
||||
}
|
||||
val, err := hex.DecodeString(hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return orderedcode.Append(nil, int64(4), int64(val))
|
||||
return orderedcode.Append(nil, int64(4), string(val))
|
||||
case bytes.HasPrefix(key, keyID("validatorsKey:")):
|
||||
val, err := strconv.Atoi(string(key[14:]))
|
||||
if err != nil {
|
||||
|
||||
@@ -27,7 +27,7 @@ func getLegacyPrefixKeys(val int) map[string][]byte {
|
||||
"BlockPartTwo": []byte(fmt.Sprintf("P:%d:%d", val+2, val+val)),
|
||||
"BlockCommit": []byte(fmt.Sprintf("C:%d", val)),
|
||||
"SeenCommit": []byte(fmt.Sprintf("SC:%d", val)),
|
||||
"BlockHeight": []byte(fmt.Sprintf("BH:%d", val)),
|
||||
"BlockHeight": []byte(fmt.Sprintf("BH:%x", val)),
|
||||
"Validators": []byte(fmt.Sprintf("validatorsKey:%d", val)),
|
||||
"ConsensusParams": []byte(fmt.Sprintf("consensusParamsKey:%d", val)),
|
||||
"ABCIResponse": []byte(fmt.Sprintf("abciResponsesKey:%d", val)),
|
||||
|
||||
Reference in New Issue
Block a user