github.com/beyonderyue/gochain@v2.2.26+incompatible/consensus/clique/gochain.go (about) 1 package clique 2 3 import ( 4 "context" 5 "math/big" 6 7 "github.com/gochain-io/gochain/consensus" 8 "github.com/gochain-io/gochain/core/state" 9 "github.com/gochain-io/gochain/core/types" 10 ) 11 12 // Block reward in wei for successfully sealing a block. 13 var BlockReward = big.NewInt(7e+18) 14 15 // Finalize implements consensus.Engine, ensuring no uncles are set, but this does give rewards. 16 func (c *Clique) Finalize(ctx context.Context, chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, receipts []*types.Receipt, block bool) *types.Block { 17 // Reward the signer. 18 state.AddBalance(header.Coinbase, BlockReward) 19 20 header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) 21 header.UncleHash = types.CalcUncleHash(nil) 22 23 if block { 24 // Assemble and return the final block for sealing 25 return types.NewBlock(header, txs, nil, receipts) 26 } 27 return nil 28 }