forked from gochain/gochain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gochain.go
28 lines (22 loc) · 904 Bytes
/
gochain.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package clique
import (
"context"
"math/big"
"github.com/gochain-io/gochain/consensus"
"github.com/gochain-io/gochain/core/state"
"github.com/gochain-io/gochain/core/types"
)
// Block reward in wei for successfully sealing a block.
var BlockReward = big.NewInt(7e+18)
// Finalize implements consensus.Engine, ensuring no uncles are set, but this does give rewards.
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 {
// Reward the signer.
state.AddBalance(header.Coinbase, BlockReward)
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
header.UncleHash = types.CalcUncleHash(nil)
if block {
// Assemble and return the final block for sealing
return types.NewBlock(header, txs, nil, receipts)
}
return nil
}