Browse Source

fixes

pull/999/head
Ethan Buchman 7 years ago
parent
commit
4171bd3bae
4 changed files with 16 additions and 14 deletions
  1. +4
    -1
      consensus/replay.go
  2. +4
    -6
      rpc/client/rpc_test.go
  3. +5
    -5
      rpc/core/blocks.go
  4. +3
    -2
      rpc/core/types/responses.go

+ 4
- 1
consensus/replay.go View File

@ -301,7 +301,10 @@ func (h *Handshaker) ReplayBlocks(appHash []byte, appBlockHeight int64, proxyApp
} else if appBlockHeight == storeBlockHeight {
// 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)
h.logger.Info("Replay last block using mock app")
return h.replayBlock(storeBlockHeight, mockApp)


+ 4
- 6
rpc/client/rpc_test.go View File

@ -168,17 +168,15 @@ func TestAppCalls(t *testing.T) {
assert.EqualValues(apph, block.BlockMeta.Header.Height)
// now check the results
blockResults, err := c.BlockResults(&apph)
blockResults, err := c.BlockResults(&txh)
require.Nil(err, "%d: %+v", i, err)
assert.Equal(apph, blockResults.Height)
if assert.Equal(1, len(blockResults.Results)) {
assert.Equal(txh, blockResults.Height)
if assert.Equal(1, len(blockResults.Results.DeliverTx)) {
// 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
// TODO: is this commented somewhere that they are returned
// in order of descending height???
info, err := c.BlockchainInfo(apph, apph)
require.Nil(err, "%d: %+v", i, err)
assert.True(info.LastHeight >= apph)


+ 5
- 5
rpc/core/blocks.go View File

@ -9,6 +9,7 @@ import (
)
// Get block headers for minHeight <= height <= maxHeight.
// Block headers are returned in descending order (highest first).
//
// ```shell
// 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.
// 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.
// Thus response.results[5] is the results of executing
// getBlock(h-1).Txs[5]
// Results are for the height of the block containing the txs.
// Thus response.results[5] is the results of executing getBlock(h).Txs[5]
//
// ```shell
// curl 'localhost:46657/block_results?height=10'
@ -364,7 +364,7 @@ func BlockResults(heightPtr *int64) (*ctypes.ResultBlockResults, error) {
// load the results
state := consensusState.GetState()
results, err := state.LoadResults(height)
results, err := state.LoadABCIResponses(height)
if err != nil {
return nil, err
}


+ 3
- 2
rpc/core/types/responses.go View File

@ -9,6 +9,7 @@ import (
"github.com/tendermint/go-wire/data"
cstypes "github.com/tendermint/tendermint/consensus/types"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
)
@ -34,8 +35,8 @@ type ResultCommit struct {
}
type ResultBlockResults struct {
Height int64 `json:"height"`
Results types.ABCIResults `json:"results"`
Height int64 `json:"height"`
Results *state.ABCIResponses `json:"results"`
}
// NewResultCommit is a helper to initialize the ResultCommit with


Loading…
Cancel
Save