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

@ -138,7 +138,7 @@ func TestValidatorChangesSaveLoad(t *testing.T) {
assert := assert.New(t)
// change vals at these heights
changeHeights := []uint64{1, 2, 4, 5, 10, 15, 16, 17, 20}
changeHeights := []int64{1, 2, 4, 5, 10, 15, 16, 17, 20}
N := len(changeHeights)
// each valset is just one validator.
@ -155,7 +155,7 @@ func TestValidatorChangesSaveLoad(t *testing.T) {
highestHeight := changeHeights[N-1] + 5
changeIndex := 0
pubkey := pubkeys[changeIndex]
for i := uint64(1); i < highestHeight; i++ {
for i := int64(1); i < highestHeight; i++ {
// when we get to a change height,
// use the next pubkey
if changeIndex < len(changeHeights) && i == changeHeights[changeIndex] {
@ -171,7 +171,7 @@ func TestValidatorChangesSaveLoad(t *testing.T) {
testCases := make([]valChangeTestCase, highestHeight)
changeIndex = 0
pubkey = pubkeys[changeIndex]
for i := uint64(1); i < highestHeight+1; i++ {
for i := int64(1); i < highestHeight+1; i++ {
// we we get to the height after a change height
// use the next pubkey (note our counter starts at 0 this time)
if changeIndex < len(changeHeights) && i == changeHeights[changeIndex]+1 {
@ -192,7 +192,7 @@ func TestValidatorChangesSaveLoad(t *testing.T) {
}
}
func makeHeaderPartsResponses(state *State, height uint64,
func makeHeaderPartsResponses(state *State, height int64,
pubkey crypto.PubKey) (*types.Header, types.PartSetHeader, *ABCIResponses) {
block := makeBlock(height, state)
@ -216,6 +216,6 @@ func makeHeaderPartsResponses(state *State, height uint64,
}
type valChangeTestCase struct {
height uint64
height int64
vals crypto.PubKey
}