Skip to content
Snippets Groups Projects
Unverified Commit 935de8d4 authored by Silas Davis's avatar Silas Davis
Browse files

Don't panic on nil Bounds


Signed-off-by: default avatarSilas Davis <silas@monax.io>
parent 51df9a2b
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,9 @@ func (b *Bound) Key(latestBlockHeight uint64) events.Key {
}
func (b *Bound) Bound(latestBlockHeight uint64) uint64 {
if b == nil {
return latestBlockHeight
}
switch b.Type {
case Bound_ABSOLUTE:
return b.GetIndex()
......
package pbevents
import (
"testing"
"github.com/hyperledger/burrow/execution/events"
"github.com/stretchr/testify/assert"
)
func TestBlockRange_Bounds(t *testing.T) {
latestHeight := uint64(2344)
br := &BlockRange{}
start, end, streaming := br.Bounds(latestHeight)
assert.Equal(t, events.NewKey(latestHeight, 0), start)
assert.Equal(t, events.NewKey(latestHeight, 0), end)
assert.False(t, streaming)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment