Skip to content

TestBlockReader fails #2

@readygo67

Description

@readygo67
func TestBlockReader(t *testing.T) {
	ch := initChain()
	b0 := ch.GenesisBlock()

	b1, q1 := newBlock(b0, 2)
	ch.AddBlock(b1, q1)

	b2, q2 := newBlock(b1, 2)
	ch.AddBlock(b2, q2)

	b3, q3 := newBlock(b2, 2)
	ch.AddBlock(b3, q3)

	b4, q4 := newBlock(b3, 2)
	ch.AddBlock(b4, q4)

	br := ch.NewBlockReader(b2.ID())

	blks, err := br.Read()
	assert.Nil(t, err)
	assert.Equal(t, blks[0].ID(), b3.ID())
	assert.False(t, blks[0].Obsolete)

	blks, err = br.Read()
	assert.Nil(t, err)
	assert.Equal(t, blks[0].ID(), b4.ID())
	assert.False(t, blks[0].Obsolete)
}
=== RUN   TestBlockReader
--- FAIL: TestBlockReader (0.00s)
panic: could not find genesis [recovered]
	panic: could not find genesis

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions