int64 height

uint64 is considered dangerous. the details will follow in a blog post.
This commit is contained in:
Anton Kaliaev
2017-12-01 19:04:53 -06:00
parent e9f8e56895
commit 922af7c405
67 changed files with 274 additions and 274 deletions

View File

@ -14,7 +14,7 @@ import (
"github.com/tendermint/tendermint/types"
)
func newBlockchainReactor(maxBlockHeight uint64) *BlockchainReactor {
func newBlockchainReactor(maxBlockHeight int64) *BlockchainReactor {
logger := log.TestingLogger()
config := cfg.ResetTestRoot("blockchain_reactor_test")
@ -34,7 +34,7 @@ func newBlockchainReactor(maxBlockHeight uint64) *BlockchainReactor {
bcReactor.Switch = p2p.NewSwitch(cfg.DefaultP2PConfig())
// Lastly: let's add some blocks in
for blockHeight := uint64(1); blockHeight <= maxBlockHeight; blockHeight++ {
for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ {
firstBlock := makeBlock(blockHeight, state)
secondBlock := makeBlock(blockHeight+1, state)
firstParts := firstBlock.MakePartSet(state.Params.BlockGossipParams.BlockPartSizeBytes)
@ -45,7 +45,7 @@ func newBlockchainReactor(maxBlockHeight uint64) *BlockchainReactor {
}
func TestNoBlockMessageResponse(t *testing.T) {
maxBlockHeight := uint64(20)
maxBlockHeight := int64(20)
bcr := newBlockchainReactor(maxBlockHeight)
bcr.Start()
@ -58,7 +58,7 @@ func TestNoBlockMessageResponse(t *testing.T) {
chID := byte(0x01)
tests := []struct {
height uint64
height int64
existent bool
}{
{maxBlockHeight + 2, false},
@ -93,14 +93,14 @@ func TestNoBlockMessageResponse(t *testing.T) {
//----------------------------------------------
// utility funcs
func makeTxs(height uint64) (txs []types.Tx) {
func makeTxs(height int64) (txs []types.Tx) {
for i := 0; i < 10; i++ {
txs = append(txs, types.Tx([]byte{byte(height), byte(i)}))
}
return txs
}
func makeBlock(height uint64, state *sm.State) *types.Block {
func makeBlock(height int64, state *sm.State) *types.Block {
prevHash := state.LastBlockID.Hash
prevParts := types.PartSetHeader{}
valHash := state.Validators.Hash()