Skip to content

Commit

Permalink
go/tendermint/api: Add LogEventPeerExchangeDisabled
Browse files Browse the repository at this point in the history
  • Loading branch information
tjanez committed Nov 6, 2019
1 parent 3cbbc99 commit 371ba4b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions go/oasis-test-runner/oasis/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/oasislabs/oasis-core/go/common/logging"
"github.com/oasislabs/oasis-core/go/oasis-test-runner/log"
roothash "github.com/oasislabs/oasis-core/go/roothash/api"
tendermint "github.com/oasislabs/oasis-core/go/tendermint/api"
)

// LogAssertEvent returns a handler which checks whether a specific log event was
Expand Down Expand Up @@ -59,3 +60,9 @@ func LogAssertMergeDiscrepancyDetected() log.WatcherHandler {
func LogAssertNoMergeDiscrepancyDetected() log.WatcherHandler {
return LogAssertNotEvent(roothash.LogEventMergeDiscrepancyDetected, "merge discrepancy detected")
}

// LogAssertPeerExchangeDisabled returns a handler which checks whether a peer
// exchange disabled event was detected based on JSON log output.
func LogAssertPeerExchangeDisabled() log.WatcherHandler {
return LogAssertEvent(tendermint.LogEventPeerExchangeDisabled, "peer exchange disabled")
}
6 changes: 6 additions & 0 deletions go/tendermint/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const (
CodeNotFound Code = Code(6)
)

const (
// LogEventPeerExchangeDisable is a log event that indicates that
// Tendermint's peer exchange has been disabled.
LogEventPeerExchangeDisabled = "tendermint/peer_exchange_disabled"
)

// ToInt returns an integer representation of the status code.
func (c Code) ToInt() uint32 {
return uint32(c)
Expand Down
6 changes: 6 additions & 0 deletions go/tendermint/tendermint.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,12 @@ func (t *tendermintService) lazyInit() error {
tenderConfig.P2P.AddrBookStrict = !viper.GetBool(CfgDebugP2PAddrBookLenient)
tenderConfig.RPC.ListenAddress = ""

if !tenderConfig.P2P.PexReactor {
t.Logger.Info("pex reactor disabled",
logging.LogEvent, api.LogEventPeerExchangeDisabled,
)
}

tendermintPV, err := crypto.LoadOrGeneratePrivVal(tendermintDataDir, t.consensusSigner)
if err != nil {
return err
Expand Down

0 comments on commit 371ba4b

Please sign in to comment.