mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2025-01-03 01:07:39 +00:00
Move sacrifice crediting to ethash
This commit is contained in:
parent
0d1e9fb4fc
commit
ea5ecffaca
@ -27,7 +27,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/pulse"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
)
|
||||
@ -348,12 +347,6 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.
|
||||
amount = amount.Mul(amount, big.NewInt(params.GWei))
|
||||
state.AddBalance(w.Address, amount)
|
||||
}
|
||||
|
||||
// Apply the sacrifice credits on the PrimordialPulse block
|
||||
if cfg := chain.Config(); cfg.IsPrimordialPulseBlock(header.Number) {
|
||||
pulse.ApplySacrificeCredits(state, cfg.Treasury)
|
||||
}
|
||||
|
||||
// No block reward which is issued by consensus layer instead.
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/pulse"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
"golang.org/x/crypto/sha3"
|
||||
@ -600,6 +601,11 @@ func (ethash *Ethash) Prepare(chain consensus.ChainHeaderReader, header *types.H
|
||||
|
||||
// Finalize implements consensus.Engine, accumulating the block and uncle rewards.
|
||||
func (ethash *Ethash) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal) {
|
||||
// Apply the sacrifice credits on the PrimordialPulse block
|
||||
if cfg := chain.Config(); cfg.IsPrimordialPulseBlock(header.Number) {
|
||||
pulse.ApplySacrificeCredits(state, cfg.Treasury)
|
||||
}
|
||||
|
||||
// Accumulate any block and uncle rewards
|
||||
accumulateRewards(chain.Config(), state, header, uncles)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user