diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index d2b2d99fe..fceb45d62 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -284,7 +284,7 @@ func (app *Application) PrepareProposal(req types.RequestPrepareProposal) types. app.mu.Lock() defer app.mu.Unlock() - return types.ResponsePrepareProposal{BlockData: app.substPrepareTx(req.BlockData)} + return types.ResponsePrepareProposal{TxRecords: app.substPrepareTx(req.Txs)} } func (*Application) ProcessProposal(req types.RequestProcessProposal) types.ResponseProcessProposal { @@ -432,14 +432,24 @@ func (app *Application) execPrepareTx(tx []byte) *types.ExecTxResult { // substPrepareTx subst all the preparetx in the blockdata // to null string(could be any arbitrary string). -func (app *Application) substPrepareTx(blockData [][]byte) [][]byte { +func (app *Application) substPrepareTx(blockData [][]byte) []*types.TxRecord { // TODO: this mechanism will change with the current spec of PrepareProposal // We now have a special type for marking a tx as changed + + trs := make([]*types.TxRecord, len(blockData)) for i, tx := range blockData { if isPrepareTx(tx) { - blockData[i] = make([]byte, len(tx)) + trs[i] = &types.TxRecord{ + Tx: make([]byte, len(tx)), + Action: types.TxRecord_ADDED, + } + continue + } + trs[i] = &types.TxRecord{ + Tx: tx, + Action: types.TxRecord_UNMODIFIED, } } - return blockData + return trs } diff --git a/test/e2e/app/app.go b/test/e2e/app/app.go index e0c080f87..e7f4e4998 100644 --- a/test/e2e/app/app.go +++ b/test/e2e/app/app.go @@ -300,7 +300,14 @@ func (app *Application) ApplySnapshotChunk(req abci.RequestApplySnapshotChunk) a } func (app *Application) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePrepareProposal { - return abci.ResponsePrepareProposal{BlockData: req.BlockData} + trs := make([]*abci.TxRecord, len(req.Txs)) + for i, tx := range req.Txs { + trs[i] = &abci.TxRecord{ + Tx: tx, + Action: abci.TxRecord_UNMODIFIED, + } + } + return abci.ResponsePrepareProposal{TxRecords: trs} } // ProcessProposal implements part of the Application interface.