mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-24 22:32:15 +00:00
types: use mtx on PartSet.String()
This commit is contained in:
parent
6456654307
commit
8ba79252c8
@ -122,6 +122,8 @@ func (rs RoundStepType) String() string {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Immutable when returned from ConsensusState.GetRoundState()
|
||||
// TODO: Actually, only the top pointer is copied,
|
||||
// so access to field pointers is still racey
|
||||
type RoundState struct {
|
||||
Height int // Height we are working on
|
||||
Round int
|
||||
|
@ -1,7 +1,7 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
. "github.com/tendermint/go-common"
|
||||
cmn "github.com/tendermint/go-common"
|
||||
cfg "github.com/tendermint/go-config"
|
||||
)
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Tendermint's interface to the application consists of multiple connections
|
||||
type AppConns interface {
|
||||
Service
|
||||
cmn.Service
|
||||
|
||||
Mempool() AppConnMempool
|
||||
Consensus() AppConnConsensus
|
||||
@ -32,7 +32,7 @@ type Handshaker interface {
|
||||
// which ensures the app and tendermint are synced.
|
||||
// TODO: on app restart, clients must reboot together
|
||||
type multiAppConn struct {
|
||||
BaseService
|
||||
cmn.BaseService
|
||||
|
||||
config cfg.Config
|
||||
|
||||
@ -52,7 +52,7 @@ func NewMultiAppConn(config cfg.Config, clientCreator ClientCreator, handshaker
|
||||
handshaker: handshaker,
|
||||
clientCreator: clientCreator,
|
||||
}
|
||||
multiAppConn.BaseService = *NewBaseService(log, "multiAppConn", multiAppConn)
|
||||
multiAppConn.BaseService = *cmn.NewBaseService(log, "multiAppConn", multiAppConn)
|
||||
return multiAppConn
|
||||
}
|
||||
|
||||
|
@ -66,17 +66,17 @@ func TestNetInfo(t *testing.T) {
|
||||
|
||||
// FIXME: This seems to trigger a race condition with client.Local
|
||||
// go test -v -race . -run=DumpCons
|
||||
// func TestDumpConsensusState(t *testing.T) {
|
||||
// for i, c := range GetClients() {
|
||||
// // FIXME: fix server so it doesn't panic on invalid input
|
||||
// nc, ok := c.(client.NetworkClient)
|
||||
// require.True(t, ok, "%d", i)
|
||||
// cons, err := nc.DumpConsensusState()
|
||||
// require.Nil(t, err, "%d: %+v", i, err)
|
||||
// assert.NotEmpty(t, cons.RoundState)
|
||||
// assert.Empty(t, cons.PeerRoundStates)
|
||||
// }
|
||||
// }
|
||||
func TestDumpConsensusState(t *testing.T) {
|
||||
for i, c := range GetClients() {
|
||||
// FIXME: fix server so it doesn't panic on invalid input
|
||||
nc, ok := c.(client.NetworkClient)
|
||||
require.True(t, ok, "%d", i)
|
||||
cons, err := nc.DumpConsensusState()
|
||||
require.Nil(t, err, "%d: %+v", i, err)
|
||||
assert.NotEmpty(t, cons.RoundState)
|
||||
assert.Empty(t, cons.PeerRoundStates)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenesisAndValidators(t *testing.T) {
|
||||
for i, c := range GetClients() {
|
||||
|
@ -16,6 +16,7 @@ func ABCIQuery(path string, data []byte, prove bool) (*ctypes.ResultABCIQuery, e
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Info("ABCIQuery", "path", path, "data", data, "result", resQuery)
|
||||
return &ctypes.ResultABCIQuery{resQuery}, nil
|
||||
}
|
||||
|
||||
|
@ -268,6 +268,8 @@ func (ps *PartSet) StringShort() string {
|
||||
if ps == nil {
|
||||
return "nil-PartSet"
|
||||
} else {
|
||||
ps.mtx.Lock()
|
||||
defer ps.mtx.Unlock()
|
||||
return fmt.Sprintf("(%v of %v)", ps.Count(), ps.Total())
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user