add optional 'prove' flag to /tx

This commit is contained in:
Ethan Buchman
2017-04-12 18:55:00 -04:00
parent 7fb0e8b30b
commit 6899c91ebe
3 changed files with 12 additions and 4 deletions

View File

@ -4,9 +4,10 @@ import (
"fmt"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
)
func Tx(hash []byte) (*ctypes.ResultTx, error) {
func Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
r, err := txIndexer.Tx(hash)
if err != nil {
return nil, err
@ -19,10 +20,16 @@ func Tx(hash []byte) (*ctypes.ResultTx, error) {
block := blockStore.LoadBlock(int(r.Height))
tx := block.Data.Txs[int(r.Index)]
var proof types.TxProof
if prove {
proof = block.Data.Txs.Proof(int(r.Index))
}
return &ctypes.ResultTx{
Height: r.Height,
Index: r.Index,
DeliverTx: r.DeliverTx,
Tx: tx,
Proof: proof,
}, nil
}