From 799efb0629f126af5a28d34fa73caf49337c5ca5 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Tue, 12 Jan 2016 19:30:31 -0500 Subject: [PATCH] merge/rebase fixes --- node/node.go | 11 ++++++----- node/node_test.go | 5 +++++ rpc/test/helpers.go | 4 +++- state/execution.go | 4 ++-- state/state.go | 1 - types/priv_validator.go | 2 +- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/node/node.go b/node/node.go index 8e85706ee..e79651719 100644 --- a/node/node.go +++ b/node/node.go @@ -7,6 +7,7 @@ import ( "net" "net/http" "strings" + "sync" "time" . "github.com/tendermint/go-common" @@ -332,21 +333,21 @@ func getState() *sm.State { // Get a connection to the proxyAppConn addr. // Check the current hash, and panic if it doesn't match. -func getProxyApp(addr string, hash []byte) (proxyAppCtx proxy.AppContext) { +func getProxyApp(addr string, hash []byte) (proxyAppConn proxy.AppConn) { // use local app (for testing) if addr == "local" { app := example.NewCounterApplication(true) - appCtx := app.Open() - proxyAppCtx = proxy.NewLocalAppContext(appCtx) + mtx := new(sync.Mutex) + proxyAppConn = proxy.NewLocalAppConn(mtx, app) } else { proxyConn, err := Connect(addr) if err != nil { Exit(Fmt("Failed to connect to proxy for mempool: %v", err)) } - remoteApp := proxy.NewRemoteAppContext(proxyConn, 1024) + remoteApp := proxy.NewRemoteAppConn(proxyConn, 1024) remoteApp.Start() - proxyAppCtx = remoteApp + proxyAppConn = remoteApp } // Check the hash diff --git a/node/node_test.go b/node/node_test.go index 4374e5142..4619de5f7 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -6,10 +6,15 @@ import ( "github.com/tendermint/go-p2p" _ "github.com/tendermint/tendermint/config/tendermint_test" + "github.com/tendermint/tendermint/types" ) func TestNodeStartStop(t *testing.T) { + // Get PrivValidator + privValidatorFile := config.GetString("priv_validator_file") + privValidator := types.LoadOrGenPrivValidator(privValidatorFile) + // Create & start node n := NewNode(privValidator) l := p2p.NewDefaultListener("tcp", config.GetString("node_laddr"), config.GetBool("skip_upnp")) diff --git a/rpc/test/helpers.go b/rpc/test/helpers.go index ac7c900ed..3932ff6a1 100644 --- a/rpc/test/helpers.go +++ b/rpc/test/helpers.go @@ -56,7 +56,9 @@ func init() { // create a new node and sleep forever func newNode(ready chan struct{}) { // Create & start node - node = nm.NewNode() + privValidatorFile := config.GetString("priv_validator_file") + privValidator := types.LoadOrGenPrivValidator(privValidatorFile) + node = nm.NewNode(privValidator) l := p2p.NewDefaultListener("tcp", config.GetString("node_laddr"), true) node.AddListener(l) node.Start() diff --git a/state/execution.go b/state/execution.go index 1578af4b3..37e3426b0 100644 --- a/state/execution.go +++ b/state/execution.go @@ -5,7 +5,7 @@ import ( "fmt" . "github.com/tendermint/go-common" - "github.com/tendermint/tendermint/events" + "github.com/tendermint/go-events" "github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/types" tmsp "github.com/tendermint/tmsp/types" @@ -90,7 +90,7 @@ func (s *State) execBlockOnProxyApp(evsw *events.EventSwitch, proxyAppConn proxy log.Warn("Error computing proxyAppConn hash", "error", err) return err } - log.Info("ExecBlock got %v valid txs and %v invalid txs", validTxs, invalidTxs) + log.Info(Fmt("ExecBlock got %v valid txs and %v invalid txs", validTxs, invalidTxs)) // Set the state's new AppHash s.AppHash = hash diff --git a/state/state.go b/state/state.go index ff05ebfa4..798e8ce72 100644 --- a/state/state.go +++ b/state/state.go @@ -8,7 +8,6 @@ import ( . "github.com/tendermint/go-common" dbm "github.com/tendermint/go-db" - "github.com/tendermint/go-events" "github.com/tendermint/go-wire" "github.com/tendermint/tendermint/types" ) diff --git a/types/priv_validator.go b/types/priv_validator.go index 78b95c6af..9b01c8a61 100644 --- a/types/priv_validator.go +++ b/types/priv_validator.go @@ -43,7 +43,7 @@ type PrivValidator struct { // PrivKey should be empty if a Signer other than the default is being used. PrivKey crypto.PrivKey `json:"priv_key"` - Signer + Signer `json:"-"` // For persistence. // Overloaded for testing.