github.com/bcskill/bcschain/v3@v3.4.9-beta2/consensus/clique/gochain.go (about)

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