lotus/node/testopts.go

21 lines
423 B
Go
Raw Normal View History

2019-07-29 19:34:34 +00:00
package node
import (
"errors"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
"github.com/filecoin-project/go-lotus/node/modules/lp2p"
)
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),
)
}