Skip to content

Commit 013df38

Browse files
authored
add fee recipient to witness (#279)
1 parent e187005 commit 013df38

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

consensus/beacon/consensus.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/ethereum/go-ethereum/params"
3131
"github.com/ethereum/go-ethereum/rpc"
3232
"github.com/ethereum/go-ethereum/trie"
33+
"github.com/ethereum/go-ethereum/trie/utils"
3334
"github.com/gballet/go-verkle"
3435
)
3536

@@ -360,7 +361,18 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.
360361
// The returned gas is not charged
361362
state.Witness().TouchAddressOnWriteAndComputeGas(w.Address[:])
362363
}
363-
// No block reward which is issued by consensus layer instead.
364+
365+
// Add the fee recipient to the witness
366+
coinbaseKey := utils.GetTreeKeyVersion(header.Coinbase[:])
367+
state.Witness().TouchAddressOnWriteAndComputeGas(coinbaseKey)
368+
coinbaseKey[31] = utils.BalanceLeafKey
369+
state.Witness().TouchAddressOnWriteAndComputeGas(coinbaseKey)
370+
coinbaseKey[31] = utils.NonceLeafKey
371+
state.Witness().TouchAddressOnWriteAndComputeGas(coinbaseKey)
372+
coinbaseKey[31] = utils.CodeKeccakLeafKey
373+
state.Witness().TouchAddressOnWriteAndComputeGas(coinbaseKey)
374+
coinbaseKey[31] = utils.CodeSizeLeafKey
375+
state.Witness().TouchAddressOnWriteAndComputeGas(coinbaseKey)
364376
}
365377

366378
// FinalizeAndAssemble implements consensus.Engine, setting the final state and

0 commit comments

Comments
 (0)