Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions internal/common/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ type Block struct {
// BlockModel represents a simplified Block structure for Swagger documentation
type BlockModel struct {
ChainId string `json:"chain_id"`
Number uint64 `json:"number"`
Hash string `json:"hash"`
BlockNumber uint64 `json:"block_number"`
BlockHash string `json:"block_hash"`
ParentHash string `json:"parent_hash"`
Timestamp uint64 `json:"timestamp"`
BlockTimestamp uint64 `json:"block_timestamp"`
Nonce string `json:"nonce"`
Sha3Uncles string `json:"sha3_uncles"`
MixHash string `json:"mix_hash"`
Expand Down Expand Up @@ -76,10 +76,10 @@ type RawBlock = map[string]interface{}
func (b *Block) Serialize() BlockModel {
return BlockModel{
ChainId: b.ChainId.String(),
Number: b.Number.Uint64(),
Hash: b.Hash,
BlockNumber: b.Number.Uint64(),
BlockHash: b.Hash,
ParentHash: b.ParentHash,
Timestamp: uint64(b.Timestamp.Unix()),
BlockTimestamp: uint64(b.Timestamp.Unix()),
Nonce: b.Nonce,
Sha3Uncles: b.Sha3Uncles,
MixHash: b.MixHash,
Expand Down
4 changes: 2 additions & 2 deletions internal/handlers/search_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func TestSearch_BlockNumber(t *testing.T) {
err := json.Unmarshal(w.Body.Bytes(), &response)
assert.NoError(t, err)
assert.Equal(t, SearchResultTypeBlock, response.Data.Type)
assert.Equal(t, blockNumber.Uint64(), response.Data.Blocks[0].Number)
assert.Equal(t, "0xabc", response.Data.Blocks[0].Hash)
assert.Equal(t, blockNumber.Uint64(), response.Data.Blocks[0].BlockNumber)
assert.Equal(t, "0xabc", response.Data.Blocks[0].BlockHash)

mockStorage.AssertExpectations(t)
}
Expand Down