Browse Source

fixes from rebase

pull/914/head
Ethan Buchman 7 years ago
parent
commit
e9f8e56895
3 changed files with 6 additions and 27 deletions
  1. +2
    -2
      rpc/client/rpc_test.go
  2. +4
    -4
      rpc/core/tx.go
  3. +0
    -21
      state/execution.go

+ 2
- 2
rpc/client/rpc_test.go View File

@ -105,7 +105,7 @@ func TestABCIQuery(t *testing.T) {
k, v, tx := MakeTxKV()
bres, err := c.BroadcastTxCommit(tx)
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
client.WaitForHeight(c, apph, nil)
@ -137,7 +137,7 @@ func TestAppCalls(t *testing.T) {
bres, err := c.BroadcastTxCommit(tx)
require.Nil(err, "%d: %+v", i, err)
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
// wait before querying


+ 4
- 4
rpc/core/tx.go View File

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


+ 0
- 21
state/execution.go View File

@ -8,7 +8,6 @@ import (
abci "github.com/tendermint/abci/types"
crypto "github.com/tendermint/go-crypto"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/state/txindex"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
@ -271,26 +270,6 @@ func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, bl
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.
// It returns the application root hash (result of abci.Commit).
func ExecCommitBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block, logger log.Logger) ([]byte, error) {


Loading…
Cancel
Save