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
|
var validTxs, invalidTxs = 0, 0
|
||||||
|
|
||||||
txResults := make([]*types.TxResult, len(block.Txs))
|
txResults := make([]*types.TxResult, len(block.Txs))
|
||||||
|
txIndex := 0
|
||||||
txHashToIndexMap := make(map[string]int)
|
|
||||||
for index, tx := range block.Txs {
|
|
||||||
txHashToIndexMap[string(tx.Hash())] = index
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute transactions and get hash
|
// Execute transactions and get hash
|
||||||
proxyCb := func(req *abci.Request, res *abci.Response) {
|
proxyCb := func(req *abci.Request, res *abci.Response) {
|
||||||
@ -89,16 +85,13 @@ func execBlockOnProxyApp(eventCache types.Fireable, proxyAppConn proxy.AppConnCo
|
|||||||
txError = txResult.Code.String()
|
txError = txResult.Code.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
tx := types.Tx(req.GetDeliverTx().Tx)
|
txResults[txIndex] = &types.TxResult{uint64(block.Height), uint32(txIndex), *txResult}
|
||||||
index, ok := txHashToIndexMap[string(tx.Hash())]
|
txIndex++
|
||||||
if ok {
|
|
||||||
txResults[index] = &types.TxResult{uint64(block.Height), uint32(index), *txResult}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: if we count we can access the tx from the block instead of
|
// NOTE: if we count we can access the tx from the block instead of
|
||||||
// pulling it from the req
|
// pulling it from the req
|
||||||
event := types.EventDataTx{
|
event := types.EventDataTx{
|
||||||
Tx: tx,
|
Tx: types.Tx(req.GetDeliverTx().Tx),
|
||||||
Data: txResult.Data,
|
Data: txResult.Data,
|
||||||
Code: txResult.Code,
|
Code: txResult.Code,
|
||||||
Log: txResult.Log,
|
Log: txResult.Log,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user