mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
no need for map - tx responses should arrive in order (Refs #237)
``` me: so we are executing them in order and receiving them in order and there is no way we could receive them out of order (due to network or something else), correct? ebuchman: if we receive them out of order, ABCI is broken ebuchman: so it is possible, if the ABCI server we're talking to is not implementing the spec ebuchman: but that shouldn't justify us building a map ```
This commit is contained in:
parent
63704454a3
commit
3478de50a1
@ -65,11 +65,7 @@ func execBlockOnProxyApp(eventCache types.Fireable, proxyAppConn proxy.AppConnCo
|
||||
var validTxs, invalidTxs = 0, 0
|
||||
|
||||
txResults := make([]*types.TxResult, len(block.Txs))
|
||||
|
||||
txHashToIndexMap := make(map[string]int)
|
||||
for index, tx := range block.Txs {
|
||||
txHashToIndexMap[string(tx.Hash())] = index
|
||||
}
|
||||
txIndex := 0
|
||||
|
||||
// Execute transactions and get hash
|
||||
proxyCb := func(req *abci.Request, res *abci.Response) {
|
||||
@ -89,16 +85,13 @@ func execBlockOnProxyApp(eventCache types.Fireable, proxyAppConn proxy.AppConnCo
|
||||
txError = txResult.Code.String()
|
||||
}
|
||||
|
||||
tx := types.Tx(req.GetDeliverTx().Tx)
|
||||
index, ok := txHashToIndexMap[string(tx.Hash())]
|
||||
if ok {
|
||||
txResults[index] = &types.TxResult{uint64(block.Height), uint32(index), *txResult}
|
||||
}
|
||||
txResults[txIndex] = &types.TxResult{uint64(block.Height), uint32(txIndex), *txResult}
|
||||
txIndex++
|
||||
|
||||
// NOTE: if we count we can access the tx from the block instead of
|
||||
// pulling it from the req
|
||||
event := types.EventDataTx{
|
||||
Tx: tx,
|
||||
Tx: types.Tx(req.GetDeliverTx().Tx),
|
||||
Data: txResult.Data,
|
||||
Code: txResult.Code,
|
||||
Log: txResult.Log,
|
||||
|
Loading…
x
Reference in New Issue
Block a user