2019-08-23 01:00:55 +00:00
|
|
|
package blockchain
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2020-01-10 23:51:49 +00:00
|
|
|
"time"
|
2019-08-23 01:00:55 +00:00
|
|
|
|
2019-11-27 05:08:18 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
2020-06-14 22:24:49 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
2019-08-23 01:00:55 +00:00
|
|
|
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
|
2020-07-16 12:11:39 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
2019-08-23 01:00:55 +00:00
|
|
|
)
|
|
|
|
|
2020-01-10 23:51:49 +00:00
|
|
|
func TestVerifyCheckpointEpoch_Ok(t *testing.T) {
|
2020-06-14 22:24:49 +00:00
|
|
|
helpers.ClearCache()
|
2020-06-23 20:40:55 +00:00
|
|
|
db, sc := testDB.SetupDB(t)
|
2020-01-10 23:51:49 +00:00
|
|
|
|
2020-06-23 20:40:55 +00:00
|
|
|
chainService := setupBeaconChain(t, db, sc)
|
2020-01-10 23:51:49 +00:00
|
|
|
chainService.genesisTime = time.Now()
|
|
|
|
|
2020-08-27 18:13:32 +00:00
|
|
|
assert.Equal(t, true, chainService.verifyCheckpointEpoch(ðpb.Checkpoint{Root: make([]byte, 32)}))
|
2020-07-16 12:11:39 +00:00
|
|
|
assert.Equal(t, false, chainService.verifyCheckpointEpoch(ðpb.Checkpoint{Epoch: 1}))
|
2020-01-10 23:51:49 +00:00
|
|
|
}
|