2021-08-25 19:00:27 +00:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
2021-09-17 19:11:30 +00:00
|
|
|
"testing"
|
2021-08-25 19:00:27 +00:00
|
|
|
|
2021-09-17 19:11:30 +00:00
|
|
|
"github.com/ethereum/go-ethereum/plugins"
|
|
|
|
"github.com/openrelayxyz/plugeth-utils/core"
|
|
|
|
)
|
2021-08-25 19:00:27 +00:00
|
|
|
|
|
|
|
func TestReorgLongHeadersHook(t *testing.T) {
|
2021-09-17 19:11:30 +00:00
|
|
|
invoked := false
|
|
|
|
done := plugins.HookTester("NewHead", func(b []byte, h core.Hash, logs [][]byte) {
|
|
|
|
invoked = true
|
|
|
|
if b == nil {
|
|
|
|
t.Errorf("Expected block to be non-nil")
|
|
|
|
}
|
|
|
|
if h == (core.Hash{}) {
|
|
|
|
t.Errorf("Expected hash to be non-empty")
|
|
|
|
}
|
|
|
|
if len(logs) > 0 {
|
|
|
|
t.Errorf("Expected some logs")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
defer done()
|
|
|
|
testReorgLong(t, true)
|
|
|
|
if !invoked {
|
|
|
|
t.Errorf("Expected plugin invocation")
|
|
|
|
}
|
2021-08-25 19:00:27 +00:00
|
|
|
}
|