Skip to content

Commit

Permalink
Complete the RPC commit/header response (dymensionxyz#219)
Browse files Browse the repository at this point in the history
* Complete the RPC commit/header response

* remove unecessary changes

* fix hash sizes
  • Loading branch information
ItzhakBokris authored Feb 2, 2023
1 parent ca3018b commit 155d83e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
15 changes: 9 additions & 6 deletions conv/abci/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func ToABCIHeaderPB(header *types.Header) tmproto.Header {
LastBlockId: tmproto.BlockID{
Hash: header.LastHeaderHash[:],
PartSetHeader: tmproto.PartSetHeader{
Total: 0,
Hash: nil,
Total: 1,
Hash: header.LastHeaderHash[:],
},
},
LastCommitHash: header.LastCommitHash[:],
Expand Down Expand Up @@ -53,8 +53,8 @@ func ToABCIHeader(header *types.Header) tmtypes.Header {
LastBlockID: tmtypes.BlockID{
Hash: header.LastHeaderHash[:],
PartSetHeader: tmtypes.PartSetHeader{
Total: 0,
Hash: nil,
Total: 1,
Hash: header.LastHeaderHash[:],
},
},
LastCommitHash: header.LastCommitHash[:],
Expand Down Expand Up @@ -125,8 +125,11 @@ func ToABCICommit(commit *types.Commit, header *types.Header) *tmtypes.Commit {
Height: int64(commit.Height),
Round: 0,
BlockID: tmtypes.BlockID{
Hash: commit.HeaderHash[:],
PartSetHeader: tmtypes.PartSetHeader{},
Hash: commit.HeaderHash[:],
PartSetHeader: tmtypes.PartSetHeader{
Total: 1,
Hash: commit.HeaderHash[:],
},
},
}
for _, sig := range commit.Signatures {
Expand Down
4 changes: 2 additions & 2 deletions rpc/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ func (c *Client) Block(ctx context.Context, height *int64) (*ctypes.ResultBlock,
Hash: hash[:],
PartSetHeader: types.PartSetHeader{
Total: 1,
Hash: []byte{0x1},
Hash: hash[:],
},
},
Block: abciBlock,
Expand All @@ -450,7 +450,7 @@ func (c *Client) BlockByHash(ctx context.Context, hash []byte) (*ctypes.ResultBl
Hash: h[:],
PartSetHeader: types.PartSetHeader{
Total: 1,
Hash: []byte{0x1},
Hash: h[:],
},
},
Block: abciBlock,
Expand Down
4 changes: 2 additions & 2 deletions types/hashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func (h *Header) Hash() [32]byte {
LastBlockID: tmtypes.BlockID{
Hash: h.LastHeaderHash[:],
PartSetHeader: tmtypes.PartSetHeader{
Total: 0,
Hash: nil,
Total: 1,
Hash: h.LastHeaderHash[:],
},
},
LastCommitHash: h.LastCommitHash[:],
Expand Down

0 comments on commit 155d83e

Please sign in to comment.