hack to not generate protos yet

This commit is contained in:
William Banfield
2022-05-17 15:06:17 -04:00
parent 351b3bf6b0
commit 5dc8a1fac0
+19
View File
@@ -2,6 +2,7 @@ package state
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
@@ -59,6 +60,7 @@ func abciResponsesKey(height int64) []byte {
// stateKey should never change after being set in init()
var stateKey []byte
var tmpABCIKey []byte
func init() {
var err error
@@ -66,6 +68,12 @@ func init() {
if err != nil {
panic(err)
}
// temporary extra key before consensus param protos are regenerated
// TODO(wbanfield) remove in next PR
tmpABCIKey, err = orderedcode.Append(nil, int64(10000))
if err != nil {
panic(err)
}
}
//----------------------
@@ -137,6 +145,12 @@ func (store dbStore) loadState(key []byte) (state State, err error) {
if err != nil {
return state, err
}
buf, err = store.db.Get(tmpABCIKey)
if err != nil {
return state, err
}
h, _ := binary.Varint(buf)
sm.ConsensusParams.ABCI.VoteExtensionsEnableHeight = h
return *sm, nil
}
@@ -181,6 +195,11 @@ func (store dbStore) save(state State, key []byte) error {
if err := batch.Set(key, stateBz); err != nil {
return err
}
bz := make([]byte, 5)
binary.PutVarint(bz, state.ConsensusParams.ABCI.VoteExtensionsEnableHeight)
if err := batch.Set(tmpABCIKey, bz); err != nil {
return err
}
return batch.WriteSync()
}