Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
didaunesp committed Oct 27, 2023
1 parent 3ecc5b4 commit cc8a8e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/dominant-strategies/go-quai/common"
"github.com/dominant-strategies/go-quai/consensus"
"github.com/dominant-strategies/go-quai/consensus/misc"
"github.com/dominant-strategies/go-quai/core/rawdb"
"github.com/dominant-strategies/go-quai/core/state"
"github.com/dominant-strategies/go-quai/core/types"
"github.com/dominant-strategies/go-quai/core/vm"
Expand Down Expand Up @@ -215,7 +216,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
chainreader := &fakeChainReader{config: config}
genblock := func(i int, parent *types.Block, statedb *state.StateDB) (*types.Block, types.Receipts) {
b := &BlockGen{i: i, chain: blocks, parent: parent, statedb: statedb, config: config, engine: engine}
b.header = makeHeader(chainreader, parent, statedb, b.engine)
b.header = makeHeader(chainreader, parent, statedb, b.engine, config.GenesisHash)

// Execute any user modifications to the block
if gen != nil {
Expand Down Expand Up @@ -243,14 +244,15 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
panic(err)
}
block, receipt := genblock(i, parent, statedb)
rawdb.WriteBlock(db, block)
blocks[i] = block
receipts[i] = receipt
parent = block
}
return blocks, receipts
}

func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.StateDB, engine consensus.Engine) *types.Header {
func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.StateDB, engine consensus.Engine, genesisHash common.Hash) *types.Header {
var time uint64
if parent.Time() == 0 {
time = 10
Expand All @@ -268,6 +270,13 @@ func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.S
header.SetNumber(new(big.Int).Add(parent.Number(), common.Big1))
header.SetTime(time)
header.SetBaseFee(misc.CalcBaseFee(chain.Config(), parent.Header()))

//new array receive its first value as genesisHash
// manifest := types.BlockManifest{genesisHash}
// header.SetManifestHash(types.DeriveSha(manifest, trie.NewStackTrie(nil)))

header.SetLocation(common.Location{0,0})

return header
}

Expand Down
1 change: 1 addition & 0 deletions quaiclient/ethclient/ethclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
}
// Create quai Service
config := &ethconfig.Config{Genesis: genesis}
config.Zone = 0
config.Miner.ExtraData = []byte("test miner")
config.Progpow.PowMode = progpow.ModeFake
config.DomUrl = "http://localhost:8080"
Expand Down

0 comments on commit cc8a8e3

Please sign in to comment.