2020-05-26 23:24:38 +00:00
|
|
|
package debug
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2021-03-12 00:03:19 +00:00
|
|
|
"github.com/golang/protobuf/ptypes/empty"
|
2020-05-26 23:24:38 +00:00
|
|
|
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/forkchoice/protoarray"
|
2021-09-23 18:53:46 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/testing/assert"
|
|
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
2020-05-26 23:24:38 +00:00
|
|
|
)
|
|
|
|
|
2022-03-09 03:05:51 +00:00
|
|
|
func TestServer_GetForkChoice_ProtoArray(t *testing.T) {
|
2022-06-09 22:28:30 +00:00
|
|
|
store := protoarray.New()
|
2022-04-28 11:34:25 +00:00
|
|
|
bs := &Server{ForkFetcher: &mock.ChainService{ForkChoiceStore: store}}
|
2022-03-09 03:05:51 +00:00
|
|
|
res, err := bs.GetForkChoice(context.Background(), &empty.Empty{})
|
2020-07-20 02:15:51 +00:00
|
|
|
require.NoError(t, err)
|
2022-06-09 22:28:30 +00:00
|
|
|
assert.Equal(t, store.JustifiedCheckpoint().Epoch, res.JustifiedEpoch, "Did not get wanted justified epoch")
|
|
|
|
assert.Equal(t, store.FinalizedCheckpoint().Epoch, res.FinalizedEpoch, "Did not get wanted finalized epoch")
|
2020-05-26 23:24:38 +00:00
|
|
|
}
|