mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 13:51:21 +00:00
merge/rebase fixes
This commit is contained in:
11
node/node.go
11
node/node.go
@ -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()
|
mtx := new(sync.Mutex)
|
||||||
proxyAppCtx = proxy.NewLocalAppContext(appCtx)
|
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
|
||||||
|
@ -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"))
|
||||||
|
@ -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()
|
||||||
|
@ -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
|
||||||
|
@ -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"
|
||||||
)
|
)
|
||||||
|
@ -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.
|
||||||
|
Reference in New Issue
Block a user