miner: bugfix, invalid transaction index in logs on local mined blocks

This commit is contained in:
Bas van Kervel 2015-12-01 16:26:06 +01:00
parent 8db9d44ca9
commit 814c1e980e

View file

@ -309,8 +309,19 @@ func (self *worker) wait() {
l.BlockHash = block.Hash() l.BlockHash = block.Hash()
} }
} }
txIndex := func(blck *types.Block, txHash common.Hash) int {
for i, tx := range blck.Transactions() {
if tx.Hash() == txHash {
return i
}
}
return 0
}
for _, log := range work.state.Logs() { for _, log := range work.state.Logs() {
log.BlockHash = block.Hash() log.BlockHash = block.Hash()
log.TxIndex = uint(txIndex(block, log.TxHash))
} }
// check if canon block and write transactions // check if canon block and write transactions