fixes from rebase

This commit is contained in:
Ethan Buchman
2017-12-01 17:21:54 -05:00
parent 3eb069a50c
commit e9f8e56895
3 changed files with 6 additions and 27 deletions

View File

@ -105,7 +105,7 @@ func TestABCIQuery(t *testing.T) {
k, v, tx := MakeTxKV() k, v, tx := MakeTxKV()
bres, err := c.BroadcastTxCommit(tx) bres, err := c.BroadcastTxCommit(tx)
require.Nil(t, err, "%d: %+v", i, err) require.Nil(t, err, "%d: %+v", i, err)
apph := int(bres.Height) + 1 // this is where the tx will be applied to the state apph := bres.Height + 1 // this is where the tx will be applied to the state
// wait before querying // wait before querying
client.WaitForHeight(c, apph, nil) client.WaitForHeight(c, apph, nil)
@ -137,7 +137,7 @@ func TestAppCalls(t *testing.T) {
bres, err := c.BroadcastTxCommit(tx) bres, err := c.BroadcastTxCommit(tx)
require.Nil(err, "%d: %+v", i, err) require.Nil(err, "%d: %+v", i, err)
require.True(bres.DeliverTx.Code.IsOK()) require.True(bres.DeliverTx.Code.IsOK())
txh := int(bres.Height) txh := bres.Height
apph := txh + 1 // this is where the tx will be applied to the state apph := txh + 1 // this is where the tx will be applied to the state
// wait before querying // wait before querying

View File

@ -89,13 +89,13 @@ func Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
var proof types.TxProof var proof types.TxProof
if prove { if prove {
// TODO: handle overflow // TODO: handle overflow
block := blockStore.LoadBlock(int(height)) block := blockStore.LoadBlock(height)
proof = block.Data.Txs.Proof(int(index)) proof = block.Data.Txs.Proof(index)
} }
return &ctypes.ResultTx{ return &ctypes.ResultTx{
Height: height, Height: height,
Index: index, Index: uint32(index),
TxResult: r.Result, TxResult: r.Result,
Tx: r.Tx, Tx: r.Tx,
Proof: proof, Proof: proof,
@ -188,7 +188,7 @@ func TxSearch(query string, prove bool) ([]*ctypes.ResultTx, error) {
if prove { if prove {
// TODO: handle overflow // TODO: handle overflow
block := blockStore.LoadBlock(int(height)) block := blockStore.LoadBlock(height)
proof = block.Data.Txs.Proof(int(index)) proof = block.Data.Txs.Proof(int(index))
} }

View File

@ -8,7 +8,6 @@ import (
abci "github.com/tendermint/abci/types" abci "github.com/tendermint/abci/types"
crypto "github.com/tendermint/go-crypto" crypto "github.com/tendermint/go-crypto"
"github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/state/txindex"
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common" cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log" "github.com/tendermint/tmlibs/log"
@ -271,26 +270,6 @@ func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, bl
return mempool.Update(block.Height, block.Txs) return mempool.Update(block.Height, block.Txs)
} }
func (s *State) indexTxs(abciResponses *ABCIResponses) {
// save the tx results using the TxIndexer
// NOTE: these may be overwriting, but the values should be the same.
batch := txindex.NewBatch(len(abciResponses.DeliverTx))
for i, d := range abciResponses.DeliverTx {
tx := abciResponses.txs[i]
if err := batch.Add(types.TxResult{
Height: abciResponses.Height,
Index: uint32(i),
Tx: tx,
Result: *d,
}); err != nil {
s.logger.Error("Error with batch.Add", "err", err)
}
}
if err := s.TxIndexer.AddBatch(batch); err != nil {
s.logger.Error("Error adding batch", "err", err)
}
}
// ExecCommitBlock executes and commits a block on the proxyApp without validating or mutating the state. // ExecCommitBlock executes and commits a block on the proxyApp without validating or mutating the state.
// It returns the application root hash (result of abci.Commit). // It returns the application root hash (result of abci.Commit).
func ExecCommitBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block, logger log.Logger) ([]byte, error) { func ExecCommitBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block, logger log.Logger) ([]byte, error) {