abci++: update PrepareProposal API to accept just a list of bytes (#9283)

This changes the ResponsePrepareProposal type, substituting the []TxRecord for just []bytes. This change is made in the .proto file and in all necessary additional places in the code.
This commit is contained in:
William Banfield
2022-08-18 16:33:19 -04:00
committed by GitHub
parent fb9afcc969
commit 1a4d9397e9
16 changed files with 314 additions and 1062 deletions

View File

@@ -259,20 +259,16 @@ func (app *Application) ApplySnapshotChunk(req abci.RequestApplySnapshotChunk) a
func (app *Application) PrepareProposal(
req abci.RequestPrepareProposal) abci.ResponsePrepareProposal {
// None of the transactions are modified by this application.
trs := make([]*abci.TxRecord, 0, len(req.Txs))
txs := make([][]byte, 0, len(req.Txs))
var totalBytes int64
for _, tx := range req.Txs {
totalBytes += int64(len(tx))
if totalBytes > req.MaxTxBytes {
break
}
trs = append(trs, &abci.TxRecord{
Action: abci.TxRecord_UNMODIFIED,
Tx: tx,
})
txs = append(txs, tx)
}
return abci.ResponsePrepareProposal{TxRecords: trs}
return abci.ResponsePrepareProposal{Txs: txs}
}
// ProcessProposal implements part of the Application interface.