feat: simapp/v2 (#20412)

Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Co-authored-by: Marko <marko@baricevic.me>
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
Co-authored-by: unknown unknown <unknown@unknown>
This commit is contained in:
Matt Kocubinski
2024-06-19 15:18:32 +00:00
committed by GitHub
co-authored by marbar3778 Marko Likhita Polavarapu unknown unknown
parent ca195c1527
commit 2d014b26c2
28 changed files with 3137 additions and 12 deletions
+7
View File
@@ -33,6 +33,10 @@ func (i *Info) Bytes() ([]byte, error) {
binary.LittleEndian.PutUint64(heightBytes, uint64(i.Height))
buf = append(buf, heightBytes...)
// TODO; permit empty hash OK for genesis block?
if len(i.Hash) == 0 {
i.Hash = make([]byte, hashSize)
}
// Encode Hash
if len(i.Hash) != hashSize {
return nil, errors.New("invalid hash size")
@@ -44,6 +48,9 @@ func (i *Info) Bytes() ([]byte, error) {
binary.LittleEndian.PutUint64(timeBytes, uint64(i.Time.Unix()))
buf = append(buf, timeBytes...)
if len(i.AppHash) == 0 {
i.AppHash = make([]byte, hashSize)
}
// Encode AppHash
if len(i.Hash) != hashSize {
return nil, errors.New("invalid hash size")