Browse Source

merge/rebase fixes

pull/178/head
Ethan Buchman 9 years ago
parent
commit
799efb0629
6 changed files with 17 additions and 10 deletions
  1. +6
    -5
      node/node.go
  2. +5
    -0
      node/node_test.go
  3. +3
    -1
      rpc/test/helpers.go
  4. +2
    -2
      state/execution.go
  5. +0
    -1
      state/state.go
  6. +1
    -1
      types/priv_validator.go

+ 6
- 5
node/node.go View File

@ -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


+ 5
- 0
node/node_test.go View File

@ -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"))


+ 3
- 1
rpc/test/helpers.go View File

@ -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()


+ 2
- 2
state/execution.go View File

@ -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


+ 0
- 1
state/state.go View File

@ -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"
)


+ 1
- 1
types/priv_validator.go View File

@ -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.


Loading…
Cancel
Save