consolidate saveResults/SaveABCIResponses

This commit is contained in:
Ethan Buchman
2017-12-25 13:47:16 -05:00
parent d65234ed51
commit 73fb1c3a17
6 changed files with 120 additions and 154 deletions

View File

@ -52,25 +52,25 @@ func execBlockOnProxyApp(txEventPublisher types.TxEventPublisher, proxyAppConn p
// TODO: make use of res.Log
// TODO: make use of this info
// Blocks may include invalid txs.
// reqDeliverTx := req.(abci.RequestDeliverTx)
txResult := r.DeliverTx
if txResult.Code == abci.CodeTypeOK {
txRes := r.DeliverTx
if txRes.Code == abci.CodeTypeOK {
validTxs++
} else {
logger.Debug("Invalid tx", "code", txResult.Code, "log", txResult.Log)
logger.Debug("Invalid tx", "code", txRes.Code, "log", txRes.Log)
invalidTxs++
}
// NOTE: if we count we can access the tx from the block instead of
// pulling it from the req
tx := types.Tx(req.GetDeliverTx().Tx)
txEventPublisher.PublishEventTx(types.EventDataTx{types.TxResult{
Height: block.Height,
Index: uint32(txIndex),
Tx: types.Tx(req.GetDeliverTx().Tx),
Result: *txResult,
Tx: tx,
Result: *txRes,
}})
abciResponses.DeliverTx[txIndex] = txResult
abciResponses.DeliverTx[txIndex] = txRes
txIndex++
}
}
@ -84,6 +84,8 @@ func execBlockOnProxyApp(txEventPublisher types.TxEventPublisher, proxyAppConn p
}
}
// TODO: determine which validators were byzantine
// Begin block
_, err := proxyAppConn.BeginBlockSync(abci.RequestBeginBlock{
Hash: block.Hash(),
@ -322,7 +324,7 @@ func (s *State) ApplyBlock(txEventPublisher types.TxEventPublisher, proxyAppConn
fail.Fail() // XXX
// save the results before we commit
s.SaveABCIResponses(abciResponses)
s.SaveABCIResponses(block.Height, abciResponses)
fail.Fail() // XXX