mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-20 08:26:31 +00:00
fixes
This commit is contained in:
@ -301,7 +301,10 @@ func (h *Handshaker) ReplayBlocks(appHash []byte, appBlockHeight int64, proxyApp
|
|||||||
|
|
||||||
} else if appBlockHeight == storeBlockHeight {
|
} else if appBlockHeight == storeBlockHeight {
|
||||||
// We ran Commit, but didn't save the state, so replayBlock with mock app
|
// We ran Commit, but didn't save the state, so replayBlock with mock app
|
||||||
abciResponses := h.state.LoadABCIResponses()
|
abciResponses, err := h.state.LoadABCIResponses(storeBlockHeight)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
mockApp := newMockProxyApp(appHash, abciResponses)
|
mockApp := newMockProxyApp(appHash, abciResponses)
|
||||||
h.logger.Info("Replay last block using mock app")
|
h.logger.Info("Replay last block using mock app")
|
||||||
return h.replayBlock(storeBlockHeight, mockApp)
|
return h.replayBlock(storeBlockHeight, mockApp)
|
||||||
|
@ -168,17 +168,15 @@ func TestAppCalls(t *testing.T) {
|
|||||||
assert.EqualValues(apph, block.BlockMeta.Header.Height)
|
assert.EqualValues(apph, block.BlockMeta.Header.Height)
|
||||||
|
|
||||||
// now check the results
|
// now check the results
|
||||||
blockResults, err := c.BlockResults(&apph)
|
blockResults, err := c.BlockResults(&txh)
|
||||||
require.Nil(err, "%d: %+v", i, err)
|
require.Nil(err, "%d: %+v", i, err)
|
||||||
assert.Equal(apph, blockResults.Height)
|
assert.Equal(txh, blockResults.Height)
|
||||||
if assert.Equal(1, len(blockResults.Results)) {
|
if assert.Equal(1, len(blockResults.Results.DeliverTx)) {
|
||||||
// check success code
|
// check success code
|
||||||
assert.EqualValues(0, blockResults.Results[0].Code)
|
assert.EqualValues(0, blockResults.Results.DeliverTx[0].Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check blockchain info, now that we know there is info
|
// check blockchain info, now that we know there is info
|
||||||
// TODO: is this commented somewhere that they are returned
|
|
||||||
// in order of descending height???
|
|
||||||
info, err := c.BlockchainInfo(apph, apph)
|
info, err := c.BlockchainInfo(apph, apph)
|
||||||
require.Nil(err, "%d: %+v", i, err)
|
require.Nil(err, "%d: %+v", i, err)
|
||||||
assert.True(info.LastHeight >= apph)
|
assert.True(info.LastHeight >= apph)
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Get block headers for minHeight <= height <= maxHeight.
|
// Get block headers for minHeight <= height <= maxHeight.
|
||||||
|
// Block headers are returned in descending order (highest first).
|
||||||
//
|
//
|
||||||
// ```shell
|
// ```shell
|
||||||
// curl 'localhost:46657/blockchain?minHeight=10&maxHeight=10'
|
// curl 'localhost:46657/blockchain?minHeight=10&maxHeight=10'
|
||||||
@ -314,11 +315,10 @@ func Commit(heightPtr *int64) (*ctypes.ResultCommit, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BlockResults gets ABCIResults at a given height.
|
// BlockResults gets ABCIResults at a given height.
|
||||||
// If no height is provided, it will fetch the latest block.
|
// If no height is provided, it will fetch results for the latest block.
|
||||||
//
|
//
|
||||||
// Results are for the tx of the last block with the same index.
|
// Results are for the height of the block containing the txs.
|
||||||
// Thus response.results[5] is the results of executing
|
// Thus response.results[5] is the results of executing getBlock(h).Txs[5]
|
||||||
// getBlock(h-1).Txs[5]
|
|
||||||
//
|
//
|
||||||
// ```shell
|
// ```shell
|
||||||
// curl 'localhost:46657/block_results?height=10'
|
// curl 'localhost:46657/block_results?height=10'
|
||||||
@ -364,7 +364,7 @@ func BlockResults(heightPtr *int64) (*ctypes.ResultBlockResults, error) {
|
|||||||
|
|
||||||
// load the results
|
// load the results
|
||||||
state := consensusState.GetState()
|
state := consensusState.GetState()
|
||||||
results, err := state.LoadResults(height)
|
results, err := state.LoadABCIResponses(height)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/tendermint/go-wire/data"
|
"github.com/tendermint/go-wire/data"
|
||||||
cstypes "github.com/tendermint/tendermint/consensus/types"
|
cstypes "github.com/tendermint/tendermint/consensus/types"
|
||||||
"github.com/tendermint/tendermint/p2p"
|
"github.com/tendermint/tendermint/p2p"
|
||||||
|
"github.com/tendermint/tendermint/state"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,8 +35,8 @@ type ResultCommit struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ResultBlockResults struct {
|
type ResultBlockResults struct {
|
||||||
Height int64 `json:"height"`
|
Height int64 `json:"height"`
|
||||||
Results types.ABCIResults `json:"results"`
|
Results *state.ABCIResponses `json:"results"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewResultCommit is a helper to initialize the ResultCommit with
|
// NewResultCommit is a helper to initialize the ResultCommit with
|
||||||
|
Reference in New Issue
Block a user