2021-11-19 15:59:26 +00:00
|
|
|
package blockchain
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
testDB "github.com/prysmaticlabs/prysm/v5/beacon-chain/db/testing"
|
|
|
|
doublylinkedtree "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/doubly-linked-tree"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/startup"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state/stategen"
|
2021-11-19 15:59:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func testServiceOptsWithDB(t *testing.T) []Option {
|
|
|
|
beaconDB := testDB.SetupDB(t)
|
2022-09-26 14:45:21 +00:00
|
|
|
fcs := doublylinkedtree.New()
|
2023-05-03 04:34:01 +00:00
|
|
|
cs := startup.NewClockSynchronizer()
|
2021-11-19 15:59:26 +00:00
|
|
|
return []Option{
|
|
|
|
WithDatabase(beaconDB),
|
2022-09-28 20:10:27 +00:00
|
|
|
WithStateGen(stategen.New(beaconDB, fcs)),
|
2021-11-19 15:59:26 +00:00
|
|
|
WithForkChoiceStore(fcs),
|
2023-05-03 04:34:01 +00:00
|
|
|
WithClockSynchronizer(cs),
|
2021-11-19 15:59:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:25:44 +00:00
|
|
|
// WARNING: only use these opts when you are certain there are no db calls
|
2021-11-19 15:59:26 +00:00
|
|
|
// in your code path. this is a lightweight way to satisfy the stategen/beacondb
|
|
|
|
// initialization requirements w/o the overhead of db init.
|
|
|
|
func testServiceOptsNoDB() []Option {
|
2023-05-03 04:34:01 +00:00
|
|
|
cs := startup.NewClockSynchronizer()
|
|
|
|
return []Option{WithClockSynchronizer(cs)}
|
2021-11-19 15:59:26 +00:00
|
|
|
}
|