MCPcopy
hub / github.com/canopy-network/canopy / newTestStateMachine

Function newTestStateMachine

fsm/state_test.go:334–360  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

332}
333
334func newTestStateMachine(t *testing.T) StateMachine {
335 log := lib.NewDefaultLogger()
336 db, err := store.NewStoreInMemory(log)
337 require.NoError(t, err)
338 sm := StateMachine{
339 store: db,
340 ProtocolVersion: 0,
341 NetworkID: 1,
342 height: 2,
343 totalVDFIterations: 0,
344 slashTracker: NewSlashTracker(),
345 proposeVoteConfig: AcceptAllProposals,
346 Config: lib.Config{
347 MainConfig: lib.DefaultMainConfig(),
348 StateMachineConfig: lib.DefaultStateMachineConfig(),
349 },
350 events: new(lib.EventsTracker),
351 log: log,
352 cache: &cache{
353 accounts: make(map[uint64]*Account),
354 },
355 }
356 require.NoError(t, sm.SetParams(DefaultParams()))
357 db.Commit()
358 require.NoError(t, sm.SetParams(DefaultParams()))
359 return sm
360}
361
362func newTestAddress(t *testing.T, variation ...int) crypto.AddressI {
363 kg := newTestKeyGroup(t, variation...)

Callers 15

TestApplyTransactionFunction · 0.85
TestCheckTxFunction · 0.85
TestCheckSignatureFunction · 0.85
TestCheckReplayFunction · 0.85
TestCheckMessageFunction · 0.85
TestCheckFeeFunction · 0.85
TestGetPaidCommitteesFunction · 0.85
TestGetCommitteeMembersFunction · 0.85

Calls 8

SetParamsMethod · 0.95
NewDefaultLoggerFunction · 0.92
NewStoreInMemoryFunction · 0.92
DefaultMainConfigFunction · 0.92
NewSlashTrackerFunction · 0.85
DefaultParamsFunction · 0.85
CommitMethod · 0.65

Tested by

no test coverage detected