Skip to content

Commit

Permalink
Map LastBlockID.Hash to LastHeaderHash in conversion (cosmos#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzdybal authored Mar 2, 2022
1 parent b0cab6e commit 5d8f737
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG-PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Month, DD, YYYY
### BUG FIXES

- [store] [Use KeyCopy instead of Key in BadgerIterator #274](https://github.com/celestiaorg/optimint/pull/274) [@tzdybal](https://github.com/tzdybal/)
- [state,block] [Do save ABCI responses for blocks #285r](https://github.com/celestiaorg/optimint/pull/285) [@tzdybal](https://github.com/tzdybal/)
- [state,block] [Do save ABCI responses for blocks #285](https://github.com/celestiaorg/optimint/pull/285) [@tzdybal](https://github.com/tzdybal/)
- [conv/abci] [Map LastBlockID.Hash to LastHeaderHash in conversion #303](https://github.com/celestiaorg/optimint/pull/303) [@tzdybal](https://github.com/tzdybal/)

- [go package] (Link to PR) Description @username
6 changes: 2 additions & 4 deletions conv/abci/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
// ToABCIHeaderPB converts Optimint header to Header format defined in ABCI.
// Caller should fill all the fields that are not available in Optimint header (like ChainID).
func ToABCIHeaderPB(header *types.Header) (tmproto.Header, error) {
hash := header.Hash()
return tmproto.Header{
Version: tmversion.Consensus{
Block: header.Version.Block,
Expand All @@ -22,7 +21,7 @@ func ToABCIHeaderPB(header *types.Header) (tmproto.Header, error) {
Height: int64(header.Height),
Time: time.Unix(int64(header.Time), 0),
LastBlockId: tmproto.BlockID{
Hash: hash[:],
Hash: header.LastHeaderHash[:],
PartSetHeader: tmproto.PartSetHeader{
Total: 0,
Hash: nil,
Expand All @@ -43,7 +42,6 @@ func ToABCIHeaderPB(header *types.Header) (tmproto.Header, error) {
// ToABCIHeader converts Optimint header to Header format defined in ABCI.
// Caller should fill all the fields that are not available in Optimint header (like ChainID).
func ToABCIHeader(header *types.Header) (tmtypes.Header, error) {
hash := header.Hash()
return tmtypes.Header{
Version: tmversion.Consensus{
Block: header.Version.Block,
Expand All @@ -52,7 +50,7 @@ func ToABCIHeader(header *types.Header) (tmtypes.Header, error) {
Height: int64(header.Height),
Time: time.Unix(int64(header.Time), 0),
LastBlockID: tmtypes.BlockID{
Hash: hash[:],
Hash: header.LastHeaderHash[:],
PartSetHeader: tmtypes.PartSetHeader{
Total: 0,
Hash: nil,
Expand Down

0 comments on commit 5d8f737

Please sign in to comment.