Browse Source

changes as per Bucky's review

pull/491/head
Anton Kaliaev 7 years ago
parent
commit
f8fdbe3dbc
No known key found for this signature in database GPG Key ID: 7B6881D965918214
24 changed files with 83 additions and 227 deletions
  1. +3
    -12
      cmd/tendermint/commands/root.go
  2. +0
    -2
      config/toml.go
  3. +3
    -0
      consensus/common_test.go
  4. +1
    -1
      consensus/reactor.go
  5. +1
    -2
      consensus/reactor_test.go
  6. +2
    -2
      consensus/replay.go
  7. +4
    -1
      consensus/replay_test.go
  8. +14
    -3
      consensus/state.go
  9. +3
    -0
      consensus/ticker.go
  10. +1
    -2
      consensus/wal.go
  11. +10
    -19
      glide.lock
  12. +4
    -7
      glide.yaml
  13. +1
    -1
      mempool/mempool.go
  14. +18
    -3
      node/node.go
  15. +0
    -153
      p2p/glide.lock
  16. +1
    -3
      p2p/peer.go
  17. +3
    -3
      p2p/switch.go
  18. +5
    -1
      p2p/types.go
  19. +3
    -1
      proxy/multi_app_conn.go
  20. +2
    -3
      rpc/lib/client/http_client.go
  21. +1
    -1
      state/execution.go
  22. +0
    -4
      state/state.go
  23. +2
    -2
      types/block.go
  24. +1
    -1
      types/priv_validator.go

+ 3
- 12
cmd/tendermint/commands/root.go View File

@ -1,7 +1,6 @@
package commands
import (
"fmt"
"os"
"github.com/spf13/cobra"
@ -27,18 +26,10 @@ var RootCmd = &cobra.Command{
err := viper.Unmarshal(config)
config.SetRoot(config.RootDir)
cfg.EnsureRoot(config.RootDir)
var option log.Option
switch config.LogLevel {
case "info":
option = log.AllowInfo()
case "debug":
option = log.AllowDebug()
case "error":
option = log.AllowError()
default:
return fmt.Errorf("Expected either \"info\", \"debug\" or \"error\" log level, given %v", config.LogLevel)
logger, err = log.NewFilterByLevel(logger, config.LogLevel)
if err != nil {
return err
}
logger = log.NewFilter(logger, option)
return err
},
}

+ 0
- 2
config/toml.go View File

@ -7,7 +7,6 @@ import (
"strings"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/logger"
)
/****** these are for production settings ***********/
@ -83,7 +82,6 @@ func ResetTestRoot(testName string) *Config {
cmn.MustWriteFile(privFilePath, []byte(testPrivValidator), 0644)
config := TestConfig().SetRoot(rootDir)
logger.SetLogLevel(config.LogLevel)
return config
}


+ 3
- 0
consensus/common_test.go View File

@ -456,6 +456,9 @@ func (m *mockTicker) Chan() <-chan timeoutInfo {
return m.c
}
func (mockTicker) SetLogger(log.Logger) {
}
//------------------------------------
func newCounter() abci.Application {


+ 1
- 1
consensus/reactor.go View File

@ -207,7 +207,7 @@ func (conR *ConsensusReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte)
case DataChannel:
if conR.fastSync {
conR.Logger.Error("Ignoring message received during fastSync", "msg", msg)
conR.Logger.Info("Ignoring message received during fastSync", "msg", msg)
return
}
switch msg := msg.(type) {


+ 1
- 2
consensus/reactor_test.go View File

@ -25,7 +25,7 @@ func startConsensusNet(t *testing.T, css []*ConsensusState, N int, subscribeEven
eventChans := make([]chan interface{}, N)
for i := 0; i < N; i++ {
reactors[i] = NewConsensusReactor(css[i], true) // so we dont start the consensus states
reactors[i].SetLogger(log.TestingLogger())
reactors[i].SetLogger(log.TestingLogger().With("reactor", i))
eventSwitch := events.NewEventSwitch()
eventSwitch.SetLogger(log.TestingLogger().With("module", "events"))
@ -265,7 +265,6 @@ func waitForAndValidateBlock(t *testing.T, n int, activeVals map[string]struct{}
eventChans[j] <- struct{}{}
wg.Done()
t.Logf("[WARN] Done wait group height=%v validator=%v", newBlock.Height, j)
}, css)
}


+ 2
- 2
consensus/replay.go View File

@ -229,7 +229,7 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error {
blockHeight := int(res.LastBlockHeight) // XXX: beware overflow
appHash := res.LastBlockAppHash
h.logger.Info("ABCI Handshake", "appHeight", blockHeight, "appHash", appHash)
h.logger.Info("ABCI Handshake", "appHeight", blockHeight, "appHash", fmt.Sprintf("%X", appHash))
// TODO: check version
@ -239,7 +239,7 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error {
return errors.New(cmn.Fmt("Error on replay: %v", err))
}
h.logger.Info("Completed ABCI Handshake - Tendermint and App are synced", "appHeight", blockHeight, "appHash", appHash)
h.logger.Info("Completed ABCI Handshake - Tendermint and App are synced", "appHeight", blockHeight, "appHash", fmt.Sprintf("%X", appHash))
// TODO: (on restart) replay mempool


+ 4
- 1
consensus/replay_test.go View File

@ -323,10 +323,13 @@ func testHandshakeReplay(t *testing.T, nBlocks int, mode uint) {
testPartSize = config.Consensus.BlockPartSize
wal, err := NewWAL(walFile, false)
wal.SetLogger(log.TestingLogger())
if err != nil {
t.Fatal(err)
}
wal.SetLogger(log.TestingLogger())
if _, err := wal.Start(); err != nil {
t.Fatal(err)
}
chain, commits, err := makeBlockchainFromWAL(wal)
if err != nil {
t.Fatalf(err.Error())


+ 14
- 3
consensus/state.go View File

@ -16,6 +16,7 @@ import (
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
)
//-----------------------------------------------------------------------------
@ -244,6 +245,12 @@ func NewConsensusState(config *cfg.ConsensusConfig, state *sm.State, proxyAppCon
//----------------------------------------
// Public interface
// SetLogger implements Service.
func (cs *ConsensusState) SetLogger(l log.Logger) {
cs.BaseService.Logger = l
cs.timeoutTicker.SetLogger(l)
}
// SetEventSwitch implements events.Eventable
func (cs *ConsensusState) SetEventSwitch(evsw types.EventSwitch) {
cs.evsw = evsw
@ -371,6 +378,10 @@ func (cs *ConsensusState) OpenWAL(walFile string) (err error) {
if err != nil {
return err
}
wal.SetLogger(cs.Logger.With("wal", walFile))
if _, err := wal.Start(); err != nil {
return err
}
cs.wal = wal
return nil
}
@ -576,7 +587,7 @@ func (cs *ConsensusState) receiveRoutine(maxSteps int) {
for {
if maxSteps > 0 {
if cs.nSteps >= maxSteps {
cs.Logger.Error("reached max steps. exiting receive routine")
cs.Logger.Info("reached max steps. exiting receive routine")
cs.nSteps = 0
return
}
@ -904,7 +915,7 @@ func (cs *ConsensusState) defaultDoPrevote(height int, round int) {
// If ProposalBlock is nil, prevote nil.
if cs.ProposalBlock == nil {
cs.Logger.Error("enterPrevote: ProposalBlock is nil")
cs.Logger.Info("enterPrevote: ProposalBlock is nil")
cs.signAddVote(types.VoteTypePrevote, nil, types.PartSetHeader{})
return
}
@ -1293,7 +1304,7 @@ func (cs *ConsensusState) addProposalBlockPart(height int, part *types.Part, ver
var err error
cs.ProposalBlock = wire.ReadBinary(&types.Block{}, cs.ProposalBlockParts.GetReader(), types.MaxBlockSize, &n, &err).(*types.Block)
// NOTE: it's possible to receive complete proposal blocks for future rounds without having the proposal
cs.Logger.Info("Received complete proposal block", "height", cs.ProposalBlock.Height, "hash", fmt.Sprintf("%X", cs.ProposalBlock.Hash()))
cs.Logger.Info("Received complete proposal block", "height", cs.ProposalBlock.Height, "hash", cs.ProposalBlock.Hash())
if cs.Step == RoundStepPropose && cs.isProposalComplete() {
// Move onto the next step
cs.enterPrevote(height, cs.Round)


+ 3
- 0
consensus/ticker.go View File

@ -4,6 +4,7 @@ import (
"time"
. "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
)
var (
@ -18,6 +19,8 @@ type TimeoutTicker interface {
Stop() bool
Chan() <-chan timeoutInfo // on which to receive a timeout
ScheduleTimeout(ti timeoutInfo) // reset the timer
SetLogger(log.Logger)
}
// timeoutTicker wraps time.Timer,


+ 1
- 2
consensus/wal.go View File

@ -50,8 +50,7 @@ func NewWAL(walFile string, light bool) (*WAL, error) {
light: light,
}
wal.BaseService = *NewBaseService(nil, "WAL", wal)
_, err = wal.Start()
return wal, err
return wal, nil
}
func (wal *WAL) OnStart() error {


+ 10
- 19
glide.lock View File

@ -1,5 +1,5 @@
hash: 9f0eb87d9c5ebe5d81759b20be7c626d081c0cfc6647b0dd586f4a682d796b58
updated: 2017-05-12T16:57:05.086543617Z
hash: 9caff08aa026986b239e4aeb9d876bdddfacadc64a660ee8109e77a211e53436
updated: 2017-05-13T14:12:48.997991788Z
imports:
- name: github.com/btcsuite/btcd
version: 1ae306021e323ae11c71ffb8546fbd9019e6cb6f
@ -28,7 +28,7 @@ imports:
subpackages:
- proto
- name: github.com/golang/protobuf
version: 157d9c53be5810dd5a0fac4a467f7d5f400042ea
version: fec3b39b059c0f88fa6b20f5ed012b1aa203a8b4
subpackages:
- proto
- ptypes/any
@ -55,10 +55,6 @@ imports:
version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0
- name: github.com/magiconair/properties
version: 51463bfca2576e06c62a8504b5c0f06d61312647
- name: github.com/mattn/go-colorable
version: ded68f7a9561c023e790de24279db7ebf473ea80
- name: github.com/mattn/go-isatty
version: fc9e8d8ef48496124e79ae0df75490096eccf6fe
- name: github.com/mitchellh/mapstructure
version: cc8532a8e9a55ea36402aa21efdf403a60d34096
- name: github.com/pelletier/go-buffruneio
@ -78,7 +74,7 @@ imports:
- name: github.com/spf13/cast
version: acbeb36b902d72a7a4c18e8f3241075e7ab763e4
- name: github.com/spf13/cobra
version: 3454e0e28e69c1b8effa6b5123c8e4185e20d696
version: 90687e7bfc7e1e5cd88eb1f513f32f01dc03dd7c
- name: github.com/spf13/jwalterweatherman
version: 8f07c835e5cc1450c082fe3a439cf87b0cbb2d99
- name: github.com/spf13/pflag
@ -106,7 +102,7 @@ imports:
- leveldb/table
- leveldb/util
- name: github.com/tendermint/abci
version: 50a9967c79d89742151c7f1a981678df8c21f9dc
version: b662bc7d3439b3c2cce615e8c3502b762e133dbf
subpackages:
- client
- example/counter
@ -121,14 +117,10 @@ imports:
- name: github.com/tendermint/go-crypto
version: e71bbb2509b586f0b24f120b6ba57f32aefa1579
- name: github.com/tendermint/go-wire
version: b53add0b622662731985485f3a19be7f684660b8
version: 82d31b6afb3c438639bffc5e1c7318b9a55285b3
subpackages:
- data
- data/base58
- name: github.com/tendermint/log15
version: f91285dece9f4875421b481da3e613d83d44f29b
subpackages:
- term
- name: github.com/tendermint/merkleeyes
version: c722818b460381bc5b82e38c73ff6e22a9df624d
subpackages:
@ -137,7 +129,7 @@ imports:
- iavl
- testutil
- name: github.com/tendermint/tmlibs
version: 25a5bc2697d2c9aedb6594366e5269bbe8f6e6ee
version: 8f5a175ff4c869fedde710615a11f5745ff69bf3
subpackages:
- autofile
- cli
@ -147,7 +139,6 @@ imports:
- events
- flowrate
- log
- logger
- merkle
- test
- name: golang.org/x/crypto
@ -162,7 +153,7 @@ imports:
- ripemd160
- salsa20/salsa
- name: golang.org/x/net
version: c9b681d35165f1995d6f3034e61f8761d4b90c99
version: 84f0e6f92b10139f986b1756e149a7d9de270cdc
subpackages:
- context
- http2
@ -172,7 +163,7 @@ imports:
- lex/httplex
- trace
- name: golang.org/x/sys
version: 156c5a2da4a2085250f45d65e24fabe6ed437394
version: f845067cf72a21fb4929b0e6a35273bd83b56396
subpackages:
- unix
- name: golang.org/x/text
@ -187,7 +178,7 @@ imports:
subpackages:
- googleapis/rpc/status
- name: google.golang.org/grpc
version: a0c3e72252b6fbf4826bb143e450eb05588a9d6d
version: 1c69e4cae0f5180ce7d8b472bf0a55d2654fe31b
subpackages:
- codes
- credentials


+ 4
- 7
glide.yaml View File

@ -11,8 +11,11 @@ import:
- package: github.com/pkg/errors
- package: github.com/spf13/cobra
- package: github.com/spf13/viper
- package: github.com/stretchr/testify
subpackages:
- require
- package: github.com/tendermint/abci
version: feature/new-logging
version: develop
subpackages:
- client
- example/dummy
@ -23,7 +26,6 @@ import:
version: develop
subpackages:
- data
- package: github.com/tendermint/log15
- package: github.com/tendermint/tmlibs
version: develop
subpackages:
@ -46,11 +48,6 @@ import:
- context
- package: google.golang.org/grpc
testImport:
- package: github.com/stretchr/testify
version: ^1.1.4
subpackages:
- assert
- require
- package: github.com/tendermint/merkleeyes
version: develop
subpackages:


+ 1
- 1
mempool/mempool.go View File

@ -13,11 +13,11 @@ import (
auto "github.com/tendermint/tmlibs/autofile"
"github.com/tendermint/tmlibs/clist"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tmlibs/log"
)
/*


+ 18
- 3
node/node.go View File

@ -75,9 +75,14 @@ func NewNode(config *cfg.Config, privValidator *types.PrivValidator, clientCreat
state := sm.GetState(stateDB, config.GenesisFile())
state.SetLogger(logger.With("module", "state"))
consensusLogger := logger.With("module", "consensus")
// Create the proxyApp, which manages connections (consensus, mempool, query)
// and sync tendermint and the app by replaying any necessary blocks
proxyApp := proxy.NewAppConns(clientCreator, consensus.NewHandshaker(state, blockStore))
handshaker := consensus.NewHandshaker(state, blockStore)
handshaker.SetLogger(consensusLogger)
proxyApp := proxy.NewAppConns(clientCreator, handshaker)
proxyApp.SetLogger(logger.With("module", "proxy"))
if _, err := proxyApp.Start(); err != nil {
cmn.Exit(cmn.Fmt("Error starting proxy app connections: %v", err))
}
@ -102,6 +107,7 @@ func NewNode(config *cfg.Config, privValidator *types.PrivValidator, clientCreat
// Make event switch
eventSwitch := types.NewEventSwitch()
eventSwitch.SetLogger(logger.With("module", "types"))
_, err := eventSwitch.Start()
if err != nil {
cmn.Exit(cmn.Fmt("Failed to start switch: %v", err))
@ -119,21 +125,28 @@ func NewNode(config *cfg.Config, privValidator *types.PrivValidator, clientCreat
// Make BlockchainReactor
bcReactor := bc.NewBlockchainReactor(state.Copy(), proxyApp.Consensus(), blockStore, fastSync)
bcReactor.SetLogger(logger.With("module", "blockchain"))
// Make MempoolReactor
mempoolLogger := logger.With("module", "consensus")
mempool := mempl.NewMempool(config.Mempool, proxyApp.Mempool())
mempool.SetLogger(logger.With("module", "mempool"))
mempool.SetLogger(mempoolLogger)
mempoolReactor := mempl.NewMempoolReactor(config.Mempool, mempool)
mempoolReactor.SetLogger(mempoolLogger)
// Make ConsensusReactor
consensusState := consensus.NewConsensusState(config.Consensus, state.Copy(), proxyApp.Consensus(), blockStore, mempool)
consensusState.SetLogger(logger.With("module", "consensus"))
consensusState.SetLogger(consensusLogger)
if privValidator != nil {
consensusState.SetPrivValidator(privValidator)
}
consensusReactor := consensus.NewConsensusReactor(consensusState, fastSync)
consensusReactor.SetLogger(consensusLogger)
p2pLogger := logger.With("module", "p2p")
sw := p2p.NewSwitch(config.P2P)
sw.SetLogger(p2pLogger)
sw.AddReactor("MEMPOOL", mempoolReactor)
sw.AddReactor("BLOCKCHAIN", bcReactor)
sw.AddReactor("CONSENSUS", consensusReactor)
@ -142,7 +155,9 @@ func NewNode(config *cfg.Config, privValidator *types.PrivValidator, clientCreat
var addrBook *p2p.AddrBook
if config.P2P.PexReactor {
addrBook = p2p.NewAddrBook(config.P2P.AddrBookFile(), config.P2P.AddrBookStrict)
addrBook.SetLogger(p2pLogger.With("book", config.P2P.AddrBookFile()))
pexReactor := p2p.NewPEXReactor(addrBook)
pexReactor.SetLogger(p2pLogger)
sw.AddReactor("PEX", pexReactor)
}


+ 0
- 153
p2p/glide.lock View File

@ -1,153 +0,0 @@
hash: 56a5590512e71b5bae4af7bd6c5e352008ad5725a8595c3e128cd18042f95b4c
updated: 2017-05-02T13:43:02.638937348Z
imports:
- name: github.com/btcsuite/btcd
version: 4b348c1d33373d672edd83fc576892d0e46686d2
subpackages:
- btcec
- name: github.com/ebuchman/fail-test
version: 95f809107225be108efcf10a3509e4ea6ceef3c4
- name: github.com/fsnotify/fsnotify
version: 4da3e2cfbabc9f751898f250b49f2439785783a1
- name: github.com/go-kit/kit
version: 8a2988aa81f699fc1e647c3c9dddce0113ef1bfb
subpackages:
- log
- log/level
- log/term
- name: github.com/go-logfmt/logfmt
version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5
- name: github.com/go-stack/stack
version: 100eb0c0a9c5b306ca2fb4f165df21d80ada4b82
- name: github.com/gogo/protobuf
version: 100ba4e885062801d56799d78530b73b178a78f3
subpackages:
- proto
- name: github.com/golang/protobuf
version: 2bba0603135d7d7f5cb73b2125beeda19c09f4ef
subpackages:
- proto
- name: github.com/gorilla/websocket
version: 3ab3a8b8831546bd18fd182c20687ca853b2bb13
- name: github.com/hashicorp/hcl
version: 7fa7fff964d035e8a162cce3a164b3ad02ad651b
subpackages:
- hcl/ast
- hcl/parser
- hcl/scanner
- hcl/strconv
- hcl/token
- json/parser
- json/scanner
- json/token
- name: github.com/kr/logfmt
version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0
- name: github.com/magiconair/properties
version: 51463bfca2576e06c62a8504b5c0f06d61312647
- name: github.com/mattn/go-colorable
version: ded68f7a9561c023e790de24279db7ebf473ea80
- name: github.com/mattn/go-isatty
version: fc9e8d8ef48496124e79ae0df75490096eccf6fe
- name: github.com/mitchellh/mapstructure
version: cc8532a8e9a55ea36402aa21efdf403a60d34096
- name: github.com/pelletier/go-buffruneio
version: c37440a7cf42ac63b919c752ca73a85067e05992
- name: github.com/pelletier/go-toml
version: fe206efb84b2bc8e8cfafe6b4c1826622be969e3
- name: github.com/pkg/errors
version: 645ef00459ed84a119197bfb8d8205042c6df63d
- name: github.com/spf13/afero
version: 9be650865eab0c12963d8753212f4f9c66cdcf12
subpackages:
- mem
- name: github.com/spf13/cast
version: acbeb36b902d72a7a4c18e8f3241075e7ab763e4
- name: github.com/spf13/cobra
version: 10f6b9d7e1631a54ad07c5c0fb71c28a1abfd3c2
- name: github.com/spf13/jwalterweatherman
version: fa7ca7e836cf3a8bb4ebf799f472c12d7e903d66
- name: github.com/spf13/pflag
version: 2300d0f8576fe575f71aaa5b9bbe4e1b0dc2eb51
- name: github.com/spf13/viper
version: 0967fc9aceab2ce9da34061253ac10fb99bba5b2
- name: github.com/stretchr/testify
version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0
subpackages:
- assert
- require
- name: github.com/tendermint/abci
version: 8d8e35ae537538c9cf6808be3ca9dd7dab81b7f6
subpackages:
- client
- example/dummy
- types
- name: github.com/tendermint/ed25519
version: 1f52c6f8b8a5c7908aff4497c186af344b428925
subpackages:
- edwards25519
- extra25519
- name: github.com/tendermint/go-crypto
version: 197a2b270fd94ee03824b158e738fce62862d0b8
- name: github.com/tendermint/go-wire
version: b53add0b622662731985485f3a19be7f684660b8
subpackages:
- data
- name: github.com/tendermint/log15
version: ae0f3d6450da9eac7074b439c8e1c3cabf0d5ce6
subpackages:
- term
- name: github.com/tendermint/tmlibs
version: 9687e4202662c11add147906faf5503af519b4ef
subpackages:
- autofile
- clist
- common
- db
- events
- flowrate
- log
- logger
- merkle
- name: golang.org/x/crypto
version: 96846453c37f0876340a66a47f3f75b1f3a6cd2d
subpackages:
- curve25519
- nacl/box
- nacl/secretbox
- openpgp/armor
- openpgp/errors
- poly1305
- ripemd160
- salsa20/salsa
- name: golang.org/x/net
version: c8c74377599bd978aee1cf3b9b63a8634051cec2
subpackages:
- context
- name: golang.org/x/sys
version: ea9bcade75cb975a0b9738936568ab388b845617
subpackages:
- unix
- name: golang.org/x/text
version: 19e3104b43db45fca0303f489a9536087b184802
subpackages:
- transform
- unicode/norm
- name: google.golang.org/grpc
version: 6914ab1e338c92da4218a23d27fcd03d0ad78d46
- name: gopkg.in/yaml.v2
version: cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b
testImports:
- name: github.com/davecgh/go-spew
version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9
subpackages:
- spew
- name: github.com/pmezard/go-difflib
version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
subpackages:
- difflib
- name: github.com/tendermint/merkleeyes
version: d0aa363fd4e015e509038c3a0ec493bc62ee0b8a
subpackages:
- app
- iavl
- testutil

+ 1
- 3
p2p/peer.go View File

@ -184,7 +184,7 @@ func (p *Peer) HandshakeTimeout(ourNodeInfo *NodeInfo, timeout time.Duration) er
return nil
}
// Addr returns peer's network address.
// Addr returns peer's remote network address.
func (p *Peer) Addr() net.Addr {
return p.conn.RemoteAddr()
}
@ -279,10 +279,8 @@ func (p *Peer) Get(key string) interface{} {
}
func dial(addr *NetAddress, config *PeerConfig) (net.Conn, error) {
// log.Info("Dialing address", "address", addr)
conn, err := addr.DialTimeout(config.DialTimeout * time.Second)
if err != nil {
// log.Info("Failed dialing address", "address", addr, "error", err)
return nil, err
}
return conn, nil


+ 3
- 3
p2p/switch.go View File

@ -310,7 +310,6 @@ func (sw *Switch) dialSeed(addr *NetAddress) {
peer, err := sw.DialPeerWithAddress(addr, true)
if err != nil {
sw.Logger.Error("Error dialing seed", "error", err)
return
} else {
sw.Logger.Info("Connected to seed", "peer", peer)
}
@ -320,10 +319,11 @@ func (sw *Switch) DialPeerWithAddress(addr *NetAddress, persistent bool) (*Peer,
sw.dialing.Set(addr.IP.String(), addr)
defer sw.dialing.Delete(addr.IP.String())
sw.Logger.Info("Dialing peer", "address", addr)
peer, err := newOutboundPeerWithConfig(addr, sw.reactorsByCh, sw.chDescs, sw.StopPeerForError, sw.nodePrivKey, sw.peerConfig)
peer.SetLogger(sw.Logger.With("peer", addr))
if err != nil {
sw.Logger.Info("Failed dialing peer", "address", addr, "error", err)
sw.Logger.Error("Failed to dial peer", "address", addr, "error", err)
return nil, err
}
if persistent {
@ -331,7 +331,7 @@ func (sw *Switch) DialPeerWithAddress(addr *NetAddress, persistent bool) (*Peer,
}
err = sw.AddPeer(peer)
if err != nil {
sw.Logger.Info("Failed adding peer", "address", addr, "error", err)
sw.Logger.Error("Failed to add peer", "address", addr, "error", err)
peer.CloseConn()
return nil, err
}


+ 5
- 1
p2p/types.go View File

@ -6,7 +6,7 @@ import (
"strconv"
"strings"
"github.com/tendermint/go-crypto"
crypto "github.com/tendermint/go-crypto"
)
const maxNodeInfoSize = 10240 // 10Kb
@ -68,6 +68,10 @@ func (info *NodeInfo) ListenPort() int {
return port_i
}
func (info NodeInfo) String() string {
return fmt.Sprintf("NodeInfo{pk: %v, moniker: %v, network: %v [remote %v, listen %v], version: %v (%v)}", info.PubKey, info.Moniker, info.Network, info.RemoteAddr, info.ListenAddr, info.Version, info.Other)
}
func splitVersion(version string) (string, string, string, error) {
spl := strings.Split(version, ".")
if len(spl) != 3 {


+ 3
- 1
proxy/multi_app_conn.go View File

@ -68,9 +68,9 @@ func (app *multiAppConn) Query() AppConnQuery {
}
func (app *multiAppConn) OnStart() error {
// query connection
querycli, err := app.clientCreator.NewABCIClient()
querycli.SetLogger(app.Logger.With("module", "abci-client", "connection", "query"))
if err != nil {
return err
}
@ -78,6 +78,7 @@ func (app *multiAppConn) OnStart() error {
// mempool connection
memcli, err := app.clientCreator.NewABCIClient()
memcli.SetLogger(app.Logger.With("module", "abci-client", "connection", "mempool"))
if err != nil {
return err
}
@ -85,6 +86,7 @@ func (app *multiAppConn) OnStart() error {
// consensus connection
concli, err := app.clientCreator.NewABCIClient()
concli.SetLogger(app.Logger.With("module", "abci-client", "connection", "consensus"))
if err != nil {
return err
}


+ 2
- 3
rpc/lib/client/http_client.go View File

@ -13,6 +13,7 @@ import (
"github.com/pkg/errors"
types "github.com/tendermint/tendermint/rpc/lib/types"
cmn "github.com/tendermint/tmlibs/common"
)
// HTTPClient is a common interface for JSONRPCClient and URIClient.
@ -26,9 +27,7 @@ func makeHTTPDialer(remoteAddr string) (string, func(string, string) (net.Conn,
parts := strings.SplitN(remoteAddr, "://", 2)
var protocol, address string
if len(parts) != 2 {
// log.Warn("WARNING (tendermint/rpc/lib): Please use fully formed listening addresses, including the tcp:// or unix:// prefix")
protocol = types.SocketType(remoteAddr)
address = remoteAddr
cmn.PanicSanity(fmt.Sprintf("Expected fully formed listening address, including the tcp:// or unix:// prefix, given %s", remoteAddr))
} else {
protocol, address = parts[0], parts[1]
}


+ 1
- 1
state/execution.go View File

@ -259,7 +259,7 @@ func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, bl
s.logger.Debug("Commit.Log: " + res.Log)
}
s.logger.Info("Committed state", "hash", fmt.Sprintf("%X", res.Data))
s.logger.Info("Committed state", "hash", res.Data)
// Set the state's new AppHash
s.AppHash = res.Data


+ 0
- 4
state/state.go View File

@ -78,10 +78,6 @@ func (s *State) SetLogger(l log.Logger) {
s.logger = l
}
func (s *State) GetLogger() log.Logger {
return s.logger
}
func (s *State) Copy() *State {
return &State{
db: s.db,


+ 2
- 2
types/block.go View File

@ -8,7 +8,7 @@ import (
"strings"
"time"
"github.com/tendermint/go-wire"
wire "github.com/tendermint/go-wire"
"github.com/tendermint/go-wire/data"
. "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/merkle"
@ -98,7 +98,7 @@ func (b *Block) FillHeader() {
// Computes and returns the block hash.
// If the block is incomplete, block hash is nil for safety.
func (b *Block) Hash() []byte {
func (b *Block) Hash() data.Bytes {
// fmt.Println(">>", b.Data)
if b == nil || b.Header == nil || b.Data == nil || b.LastCommit == nil {
return nil


+ 1
- 1
types/priv_validator.go View File

@ -181,7 +181,7 @@ func (privVal *PrivValidator) SignProposal(chainID string, proposal *Proposal) e
defer privVal.mtx.Unlock()
signature, err := privVal.signBytesHRS(proposal.Height, proposal.Round, stepPropose, SignBytes(chainID, proposal))
if err != nil {
return errors.New(Fmt("Error signing proposal: %v", err))
return fmt.Errorf("Error signing proposal: %v", err)
}
proposal.Signature = signature
return nil


Loading…
Cancel
Save