You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB

  1. package core
  2. import (
  3. cfg "github.com/tendermint/go-config"
  4. "github.com/tendermint/go-p2p"
  5. "github.com/tendermint/go-events"
  6. bc "github.com/tendermint/tendermint/blockchain"
  7. "github.com/tendermint/tendermint/consensus"
  8. mempl "github.com/tendermint/tendermint/mempool"
  9. "github.com/tendermint/tendermint/types"
  10. )
  11. var eventSwitch *events.EventSwitch
  12. var blockStore *bc.BlockStore
  13. var consensusState *consensus.ConsensusState
  14. var consensusReactor *consensus.ConsensusReactor
  15. var mempoolReactor *mempl.MempoolReactor
  16. var p2pSwitch *p2p.Switch
  17. var privValidator *types.PrivValidator
  18. var genDoc *types.GenesisDoc // cache the genesis structure
  19. var config cfg.Config = nil
  20. func SetConfig(c cfg.Config) {
  21. config = c
  22. }
  23. func SetEventSwitch(evsw *events.EventSwitch) {
  24. eventSwitch = evsw
  25. }
  26. func SetBlockStore(bs *bc.BlockStore) {
  27. blockStore = bs
  28. }
  29. func SetConsensusState(cs *consensus.ConsensusState) {
  30. consensusState = cs
  31. }
  32. func SetConsensusReactor(cr *consensus.ConsensusReactor) {
  33. consensusReactor = cr
  34. }
  35. func SetMempoolReactor(mr *mempl.MempoolReactor) {
  36. mempoolReactor = mr
  37. }
  38. func SetSwitch(sw *p2p.Switch) {
  39. p2pSwitch = sw
  40. }
  41. func SetPrivValidator(pv *types.PrivValidator) {
  42. privValidator = pv
  43. }
  44. func SetGenesisDoc(doc *types.GenesisDoc) {
  45. genDoc = doc
  46. }