lotus/node/testopts.go
2019-07-10 15:03:40 +02:00

20 lines
422 B
Go

package node
import (
"errors"
"github.com/filecoin-project/go-lotus/node/modules/lp2p"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
)
func MockHost(mn mocknet.Mocknet) Option {
return Options(
applyIf(func(s *settings) bool { return !s.online },
Error(errors.New("MockHost must be specified after Online")),
),
Override(new(lp2p.RawHost), lp2p.MockHost),
Override(new(mocknet.Mocknet), mn),
)
}