Browse Source

remove unnecessary casts (Refs #911)

pull/914/head
Anton Kaliaev 7 years ago
committed by Ethan Buchman
parent
commit
86af889dfb
3 changed files with 5 additions and 6 deletions
  1. +2
    -3
      consensus/wal_test.go
  2. +2
    -2
      mempool/mempool.go
  3. +1
    -1
      types/protobuf.go

+ 2
- 3
consensus/wal_test.go View File

@ -48,8 +48,8 @@ func TestSearchForEndHeight(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
h := 3
gr, found, err := wal.SearchForEndHeight(uint64(h))
h := uint64(3)
gr, found, err := wal.SearchForEndHeight(h)
assert.NoError(t, err, cmn.Fmt("expected not to err on height %d", h)) assert.NoError(t, err, cmn.Fmt("expected not to err on height %d", h))
assert.True(t, found, cmn.Fmt("expected to find end height for %d", h)) assert.True(t, found, cmn.Fmt("expected to find end height for %d", h))
assert.NotNil(t, gr, "expected group not to be nil") assert.NotNil(t, gr, "expected group not to be nil")
@ -61,7 +61,6 @@ func TestSearchForEndHeight(t *testing.T) {
rs, ok := msg.Msg.(tmtypes.EventDataRoundState) rs, ok := msg.Msg.(tmtypes.EventDataRoundState)
assert.True(t, ok, "expected message of type EventDataRoundState") assert.True(t, ok, "expected message of type EventDataRoundState")
assert.Equal(t, rs.Height, h+1, cmn.Fmt("wrong height")) assert.Equal(t, rs.Height, h+1, cmn.Fmt("wrong height"))
} }
var initOnce sync.Once var initOnce sync.Once


+ 2
- 2
mempool/mempool.go View File

@ -66,7 +66,7 @@ type Mempool struct {
recheckCursor *clist.CElement // next expected response recheckCursor *clist.CElement // next expected response
recheckEnd *clist.CElement // re-checking stops here recheckEnd *clist.CElement // re-checking stops here
notifiedTxsAvailable bool // true if fired on txsAvailable for this height notifiedTxsAvailable bool // true if fired on txsAvailable for this height
txsAvailable chan uint64 // fires the next height once for each height, when the mempool is not empty
txsAvailable chan uint64 // fires the next height once for each height, when the mempool is not empty
// Keep a cache of already-seen txs. // Keep a cache of already-seen txs.
// This reduces the pressure on the proxyApp. // This reduces the pressure on the proxyApp.
@ -433,7 +433,7 @@ type mempoolTx struct {
// Height returns the height for this transaction // Height returns the height for this transaction
func (memTx *mempoolTx) Height() uint64 { func (memTx *mempoolTx) Height() uint64 {
return uint64(atomic.LoadUint64(&memTx.height))
return atomic.LoadUint64(&memTx.height)
} }
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------


+ 1
- 1
types/protobuf.go View File

@ -13,7 +13,7 @@ type tm2pb struct{}
func (tm2pb) Header(header *Header) *types.Header { func (tm2pb) Header(header *Header) *types.Header {
return &types.Header{ return &types.Header{
ChainId: header.ChainID, ChainId: header.ChainID,
Height: uint64(header.Height),
Height: header.Height,
Time: uint64(header.Time.Unix()), Time: uint64(header.Time.Unix()),
NumTxs: uint64(header.NumTxs), NumTxs: uint64(header.NumTxs),
LastBlockId: TM2PB.BlockID(header.LastBlockID), LastBlockId: TM2PB.BlockID(header.LastBlockID),


Loading…
Cancel
Save