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"
"net/http" "net/http"
"strings" "strings"
"sync"
"time" "time"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
@ -332,21 +333,21 @@ func getState() *sm.State {
// Get a connection to the proxyAppConn addr. // Get a connection to the proxyAppConn addr.
// Check the current hash, and panic if it doesn't match. // 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) // use local app (for testing)
if addr == "local" { if addr == "local" {
app := example.NewCounterApplication(true) app := example.NewCounterApplication(true)
appCtx := app.Open()
proxyAppCtx = proxy.NewLocalAppContext(appCtx)
mtx := new(sync.Mutex)
proxyAppConn = proxy.NewLocalAppConn(mtx, app)
} else { } else {
proxyConn, err := Connect(addr) proxyConn, err := Connect(addr)
if err != nil { if err != nil {
Exit(Fmt("Failed to connect to proxy for mempool: %v", err)) Exit(Fmt("Failed to connect to proxy for mempool: %v", err))
} }
remoteApp := proxy.NewRemoteAppContext(proxyConn, 1024)
remoteApp := proxy.NewRemoteAppConn(proxyConn, 1024)
remoteApp.Start() remoteApp.Start()
proxyAppCtx = remoteApp
proxyAppConn = remoteApp
} }
// Check the hash // Check the hash


+ 5
- 0
node/node_test.go View File

@ -6,10 +6,15 @@ import (
"github.com/tendermint/go-p2p" "github.com/tendermint/go-p2p"
_ "github.com/tendermint/tendermint/config/tendermint_test" _ "github.com/tendermint/tendermint/config/tendermint_test"
"github.com/tendermint/tendermint/types"
) )
func TestNodeStartStop(t *testing.T) { func TestNodeStartStop(t *testing.T) {
// Get PrivValidator
privValidatorFile := config.GetString("priv_validator_file")
privValidator := types.LoadOrGenPrivValidator(privValidatorFile)
// Create & start node // Create & start node
n := NewNode(privValidator) n := NewNode(privValidator)
l := p2p.NewDefaultListener("tcp", config.GetString("node_laddr"), config.GetBool("skip_upnp")) 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 // create a new node and sleep forever
func newNode(ready chan struct{}) { func newNode(ready chan struct{}) {
// Create & start node // 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) l := p2p.NewDefaultListener("tcp", config.GetString("node_laddr"), true)
node.AddListener(l) node.AddListener(l)
node.Start() node.Start()


+ 2
- 2
state/execution.go View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tendermint/events"
"github.com/tendermint/go-events"
"github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
tmsp "github.com/tendermint/tmsp/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) log.Warn("Error computing proxyAppConn hash", "error", err)
return 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 // Set the state's new AppHash
s.AppHash = hash s.AppHash = hash


+ 0
- 1
state/state.go View File

@ -8,7 +8,6 @@ import (
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
dbm "github.com/tendermint/go-db" dbm "github.com/tendermint/go-db"
"github.com/tendermint/go-events"
"github.com/tendermint/go-wire" "github.com/tendermint/go-wire"
"github.com/tendermint/tendermint/types" "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 should be empty if a Signer other than the default is being used.
PrivKey crypto.PrivKey `json:"priv_key"` PrivKey crypto.PrivKey `json:"priv_key"`
Signer
Signer `json:"-"`
// For persistence. // For persistence.
// Overloaded for testing. // Overloaded for testing.


Loading…
Cancel
Save