mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 06:54:41 +00:00
rebase fixes and BeginBlock(hash,header)
This commit is contained in:
+3
-3
@@ -14,7 +14,7 @@ type AppConnConsensus interface {
|
||||
|
||||
InitChainSync(validators []*types.Validator) (err error)
|
||||
|
||||
BeginBlockSync(header *types.Header) (err error)
|
||||
BeginBlockSync(hash []byte, header *types.Header) (err error)
|
||||
AppendTxAsync(tx []byte) *tmspcli.ReqRes
|
||||
EndBlockSync(height uint64) (changedValidators []*types.Validator, err error)
|
||||
CommitSync() (res types.Result)
|
||||
@@ -65,8 +65,8 @@ func (app *appConnConsensus) InitChainSync(validators []*types.Validator) (err e
|
||||
return app.appConn.InitChainSync(validators)
|
||||
}
|
||||
|
||||
func (app *appConnConsensus) BeginBlockSync(header *types.Header) (err error) {
|
||||
return app.appConn.BeginBlockSync(header)
|
||||
func (app *appConnConsensus) BeginBlockSync(hash []byte, header *types.Header) (err error) {
|
||||
return app.appConn.BeginBlockSync(hash, header)
|
||||
}
|
||||
|
||||
func (app *appConnConsensus) AppendTxAsync(tx []byte) *tmspcli.ReqRes {
|
||||
|
||||
+5
-36
@@ -3,14 +3,10 @@ package proxy
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
cfg "github.com/tendermint/go-config"
|
||||
"github.com/tendermint/tendermint/types" // ...
|
||||
tmspcli "github.com/tendermint/tmsp/client"
|
||||
"github.com/tendermint/tmsp/example/dummy"
|
||||
nilapp "github.com/tendermint/tmsp/example/nil"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
//-----------------------------
|
||||
@@ -148,10 +144,11 @@ func (app *multiAppConn) Handshake() error {
|
||||
return fmt.Errorf("Handshake error. Block hash at height %d does not match. Got %X, expected %X", blockHeight, blockHash, blockMeta.Hash)
|
||||
}
|
||||
|
||||
// NOTE: app hash should be in the next block ...
|
||||
// check app hash
|
||||
if !bytes.Equal(blockMeta.Header.AppHash, appHash) {
|
||||
/*if !bytes.Equal(blockMeta.Header.AppHash, appHash) {
|
||||
return fmt.Errorf("Handshake error. App hash at height %d does not match. Got %X, expected %X", blockHeight, appHash, blockMeta.Header.AppHash)
|
||||
}
|
||||
}*/
|
||||
|
||||
header = blockMeta.Header
|
||||
partsHeader = blockMeta.PartsHeader
|
||||
@@ -163,7 +160,7 @@ func (app *multiAppConn) Handshake() error {
|
||||
}
|
||||
|
||||
// replay blocks up to the latest in the blockstore
|
||||
err := app.state.ReplayBlocks(header, partsHeader, app.consensusConn, app.blockStore)
|
||||
err := app.state.ReplayBlocks(appHash, header, partsHeader, app.consensusConn, app.blockStore)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error on replay: %v", err)
|
||||
}
|
||||
@@ -172,31 +169,3 @@ func (app *multiAppConn) Handshake() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
|
||||
// Get a connected tmsp client
|
||||
func NewTMSPClient(addr, transport string) (tmspcli.Client, error) {
|
||||
var client tmspcli.Client
|
||||
|
||||
// use local app (for testing)
|
||||
switch addr {
|
||||
case "nilapp":
|
||||
app := nilapp.NewNilApplication()
|
||||
mtx := new(sync.Mutex) // TODO
|
||||
client = tmspcli.NewLocalClient(mtx, app)
|
||||
case "dummy":
|
||||
app := dummy.NewDummyApplication()
|
||||
mtx := new(sync.Mutex) // TODO
|
||||
client = tmspcli.NewLocalClient(mtx, app)
|
||||
default:
|
||||
// Run forever in a loop
|
||||
mustConnect := false
|
||||
remoteApp, err := tmspcli.NewClient(addr, transport, mustConnect)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to connect to proxy for mempool: %v", err)
|
||||
}
|
||||
client = remoteApp
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
type State interface {
|
||||
ReplayBlocks(*types.Header, types.PartSetHeader, AppConnConsensus, BlockStore) error
|
||||
ReplayBlocks([]byte, *types.Header, types.PartSetHeader, AppConnConsensus, BlockStore) error
|
||||
}
|
||||
|
||||
type BlockStore interface {
|
||||
|
||||
Reference in New Issue
Block a user