mirror of
https://github.com/tendermint/tendermint.git
synced 2026-07-22 07:52:44 +00:00
add tx conversions to get consensus tests to pass
This commit is contained in:
@@ -202,3 +202,15 @@ func mustResultsToByteSlices(r []*ExecTxResult) [][]byte {
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// IncludedTxs returns all of the TxRecords that are marked for inclusion in the
|
||||
// proposed block.
|
||||
func (rpp *ResponsePrepareProposal) IncludedTxs() []*TxRecord {
|
||||
trs := []*TxRecord{}
|
||||
for _, tr := range rpp.TxRecords {
|
||||
if tr.Action == TxRecord_ADDED || tr.Action == TxRecord_UNMODIFIED {
|
||||
trs = append(trs, tr)
|
||||
}
|
||||
}
|
||||
return trs
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ func (blockExec *BlockExecutor) CreateProposalBlock(
|
||||
panic(fmt.Sprintf("application returned invalid ResponsePrepareProposal: %s", err))
|
||||
}
|
||||
|
||||
return state.BlockFromResponsePrepareProposal(height, preparedProposal)
|
||||
return state.MakeBlock(height, types.TxRecordsToTxs(preparedProposal.IncludedTxs()), commit, evidence, proposerAddr)
|
||||
}
|
||||
|
||||
func (blockExec *BlockExecutor) ProcessProposal(
|
||||
|
||||
+10
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto/merkle"
|
||||
"github.com/tendermint/tendermint/crypto/tmhash"
|
||||
tmbytes "github.com/tendermint/tendermint/libs/bytes"
|
||||
@@ -102,6 +103,15 @@ func ToTxs(txs [][]byte) Txs {
|
||||
return txBzs
|
||||
}
|
||||
|
||||
// TxRecordsToTxs coverts from the abci Tx type to the a Txs type.
|
||||
func TxRecordsToTxs(trs []*abci.TxRecord) Txs {
|
||||
txs := make([]Tx, len(trs))
|
||||
for i, tr := range trs {
|
||||
txs[i] = Tx(tr.Tx)
|
||||
}
|
||||
return txs
|
||||
}
|
||||
|
||||
// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree.
|
||||
type TxProof struct {
|
||||
RootHash tmbytes.HexBytes `json:"root_hash"`
|
||||
|
||||
Reference in New Issue
Block a user