ConfigureRPC makes sure RPC has all the objects it needs to operate.
()
| 1065 | |
| 1066 | // ConfigureRPC makes sure RPC has all the objects it needs to operate. |
| 1067 | func (n *Node) ConfigureRPC() error { |
| 1068 | pubKey, err := n.privValidator.GetPubKey() |
| 1069 | if err != nil { |
| 1070 | return fmt.Errorf("can't get pubkey: %w", err) |
| 1071 | } |
| 1072 | rpccore.SetEnvironment(&rpccore.Environment{ |
| 1073 | ProxyAppQuery: n.proxyApp.Query(), |
| 1074 | ProxyAppMempool: n.proxyApp.Mempool(), |
| 1075 | |
| 1076 | StateStore: n.stateStore, |
| 1077 | BlockStore: n.blockStore, |
| 1078 | EvidencePool: n.evidencePool, |
| 1079 | ConsensusState: n.consensusState, |
| 1080 | P2PPeers: n.sw, |
| 1081 | P2PTransport: n, |
| 1082 | |
| 1083 | PubKey: pubKey, |
| 1084 | GenDoc: n.genesisDoc, |
| 1085 | TxIndexer: n.txIndexer, |
| 1086 | BlockIndexer: n.blockIndexer, |
| 1087 | ConsensusReactor: &consensus.Reactor{}, |
| 1088 | EventBus: n.eventBus, |
| 1089 | Mempool: n.mempool, |
| 1090 | |
| 1091 | Logger: n.Logger.With("module", "rpc"), |
| 1092 | |
| 1093 | Config: *n.config.RPC, |
| 1094 | }) |
| 1095 | return nil |
| 1096 | } |
| 1097 | |
| 1098 | func (n *Node) startRPC() ([]net.Listener, error) { |
| 1099 | err := n.ConfigureRPC() |