mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
miner: bugfix, invalid transaction index in logs on local mined blocks
This commit is contained in:
parent
8db9d44ca9
commit
814c1e980e
1 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue