dao: put contract IDs into keys using big endianness

We don't have a need to iterate over them at the moment, but since we're
changing the DB format in the next release anyway let's add this ability also,
just in case.
This commit is contained in:
Roman Khimov 2022-02-18 14:38:51 +03:00
parent 600da6909c
commit de2579ec07
2 changed files with 2 additions and 2 deletions

View file

@ -46,7 +46,7 @@ import (
// Tuning parameters.
const (
headerBatchCount = 2000
version = "0.2.4"
version = "0.2.5"
defaultInitialGAS = 52000000_00000000
defaultGCPeriod = 10000

View file

@ -99,7 +99,7 @@ func (dao *Simple) putWithBuffer(entity io.Serializable, key []byte, buf *io.Buf
func (dao *Simple) makeContractIDKey(id int32) []byte {
key := dao.getKeyBuf(5)
key[0] = byte(storage.STContractID)
binary.LittleEndian.PutUint32(key[1:], uint32(id))
binary.BigEndian.PutUint32(key[1:], uint32(id))
return key
}