@@ -791,30 +791,31 @@ func (bs *BlockStore) DeleteLatestBlock() error {
791791 return bs .saveStateAndWriteDB (batch , "failed to delete the latest block" )
792792}
793793
794- // SaveTxInfo indexes the txs from the block with the given response codes and logs from execution.
794+ // SaveTxInfo indexes the txs from the block with the given execution results .
795795// Only the error logs are saved for failed transactions.
796- func (bs * BlockStore ) SaveTxInfo (block * types.Block , txResponseCodes []uint32 , logs []string ) error {
797- if len (txResponseCodes ) != len (block .Txs ) {
798- return errors .New ("txResponseCodes length mismatch with block txs length" )
799- }
800- if len (logs ) != len (block .Txs ) {
801- return errors .New ("logs length mismatch with block txs length" )
796+ func (bs * BlockStore ) SaveTxInfo (block * types.Block , execTxRes []* abci.ExecTxResult ) error {
797+ if len (execTxRes ) != len (block .Txs ) {
798+ return errors .New ("tx execution results length mismatch with block txs length" )
802799 }
803800
804801 // Create a new batch
805802 batch := bs .db .NewBatch ()
806803
807804 // Batch and save txs from the block
808805 for i , tx := range block .Txs {
806+ result := execTxRes [i ]
809807 txInfo := cmtstore.TxInfo {
810808 Height : block .Height ,
811809 //nolint:gosec
812- Index : uint32 (i ),
813- Code : txResponseCodes [i ],
810+ Index : uint32 (i ),
811+ Code : result .Code ,
812+ Codespace : result .Codespace ,
813+ GasWanted : result .GasWanted ,
814+ GasUsed : result .GasUsed ,
814815 }
815816 // Set error log for failed txs
816- if txResponseCodes [ i ] != abci .CodeTypeOK {
817- txInfo .Error = logs [ i ]
817+ if result . Code != abci .CodeTypeOK {
818+ txInfo .Error = result . Log
818819 }
819820 txInfoBytes , err := proto .Marshal (& txInfo )
820821 if err != nil {
0 commit comments