Example #1
0
// Private. Create a new node.
func startNode(nd *node.Node, ready chan struct{}, shutDown <-chan struct{}) {
	laddr := tmConfig.GetString("node_laddr")
	if laddr != "" {
		l := p2p.NewDefaultListener("tcp", laddr)
		nd.AddListener(l)
	}

	nd.Start()

	// If seedNode is provided by config, dial out.

	if len(tmConfig.GetString("seeds")) > 0 {
		nd.DialSeed()
	}

	if len(tmConfig.GetString("rpc_laddr")) > 0 {
		nd.StartRPC()
	}
	ready <- struct{}{}
	// Block until everything is shut down.
	<-shutDown
	nd.Stop()
}
Example #2
0
// Create a new rpc pipe.
func NewPipe(tNode *node.Node) Pipe {
	accounts := newAccounts(tNode.ConsensusState(), tNode.MempoolReactor())
	blockchain := newBlockchain(tNode.BlockStore())
	consensus := newConsensus(tNode.ConsensusState(), tNode.Switch())
	events := newEvents(tNode.EventSwitch())
	namereg := newNamereg(tNode.ConsensusState())
	net := newNetwork(tNode.Switch())
	txs := newTransactor(tNode.EventSwitch(), tNode.ConsensusState(), tNode.MempoolReactor(), events)
	return &PipeImpl{
		tNode,
		accounts,
		blockchain,
		consensus,
		events,
		namereg,
		net,
		txs,
	}
}