mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-15 16:33:47 +00:00
add genesis alloc to hook
This commit is contained in:
parent
b692a68a3b
commit
2a59d24b73
3 changed files with 5 additions and 4 deletions
|
|
@ -162,7 +162,7 @@ type BlockchainLogger interface {
|
||||||
// `td` is the total difficulty prior to `block`.
|
// `td` is the total difficulty prior to `block`.
|
||||||
OnBlockStart(block *types.Block, td *big.Int, finalized *types.Header, safe *types.Header)
|
OnBlockStart(block *types.Block, td *big.Int, finalized *types.Header, safe *types.Header)
|
||||||
OnBlockEnd(err error)
|
OnBlockEnd(err error)
|
||||||
OnGenesisBlock(genesis *types.Block)
|
OnGenesisBlock(genesis *types.Block, alloc GenesisAlloc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlockChain represents the canonical chain given a database with a genesis
|
// BlockChain represents the canonical chain given a database with a genesis
|
||||||
|
|
|
||||||
|
|
@ -485,7 +485,7 @@ func (g *Genesis) Commit(db ethdb.Database, triedb *trie.Database, bcLogger Bloc
|
||||||
return nil, errors.New("can't start clique chain without signers")
|
return nil, errors.New("can't start clique chain without signers")
|
||||||
}
|
}
|
||||||
if bcLogger != nil {
|
if bcLogger != nil {
|
||||||
bcLogger.OnGenesisBlock(block)
|
bcLogger.OnGenesisBlock(block, g.Alloc)
|
||||||
}
|
}
|
||||||
// All the checks has passed, flush the states derived from the genesis
|
// All the checks has passed, flush the states derived from the genesis
|
||||||
// specification as well as the specification itself into the provided
|
// specification as well as the specification itself into the provided
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
)
|
)
|
||||||
|
|
@ -82,8 +83,8 @@ func (p *Printer) OnBlockEnd(err error) {
|
||||||
fmt.Printf("OnBlockEnd: err=%v\n", err)
|
fmt.Printf("OnBlockEnd: err=%v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) OnGenesisBlock(b *types.Block) {
|
func (p *Printer) OnGenesisBlock(b *types.Block, alloc core.GenesisAlloc) {
|
||||||
fmt.Printf("OnGenesisBlock: b=%v\n", b.NumberU64())
|
fmt.Printf("OnGenesisBlock: b=%v, allocLength=%d\n", b.NumberU64(), len(alloc))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) OnBalanceChange(a common.Address, prev, new *big.Int) {
|
func (p *Printer) OnBalanceChange(a common.Address, prev, new *big.Int) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue