diff --git a/.nancy-ignore b/.nancy-ignore new file mode 100644 index 0000000000..062a7015a1 --- /dev/null +++ b/.nancy-ignore @@ -0,0 +1 @@ +CVE-2024-34478 # "CWE-754: Improper Check for Unusual or Exceptional Conditions." This vulnerability is BTC only, BSC does not have the issue. diff --git a/CHANGELOG.md b/CHANGELOG.md index b17a062f5d..b3f88cb846 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,18 @@ # Changelog +## v1.4.7 +### FEATURE +* [\#2439](https://github.com/bnb-chain/bsc/pull/2439) config: setup Mainnet Tycho(Cancun) hardfork date + +### IMPROVEMENT +* [\#2396](https://github.com/bnb-chain/bsc/pull/2396) metrics: add blockInsertMgaspsGauge to trace mgasps +* [\#2411](https://github.com/bnb-chain/bsc/pull/2411) build(deps): bump golang.org/x/net from 0.19.0 to 0.23.0 +* [\#2435](https://github.com/bnb-chain/bsc/pull/2435) txpool: limit max gas when mining is enabled +* [\#2438](https://github.com/bnb-chain/bsc/pull/2438) fix: performance issue when load journal +* [\#2440](https://github.com/bnb-chain/bsc/pull/2440) nancy: add files .nancy-ignore + +### BUGFIX +NA + ## v1.4.6 ### FEATURE * [\#2227](https://github.com/bnb-chain/bsc/pull/2227) core: separated databases for block data diff --git a/cmd/geth/main.go b/cmd/geth/main.go index a2e48c7465..1325957cb1 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -25,6 +25,8 @@ import ( "strings" "time" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/cmd/utils" @@ -456,6 +458,10 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isCon // Set the gas price to the limits from the CLI and start mining gasprice := flags.GlobalBig(ctx, utils.MinerGasPriceFlag.Name) ethBackend.TxPool().SetGasTip(gasprice) + gasCeil := ethBackend.Miner().GasCeil() + if gasCeil > params.SystemTxsGas { + ethBackend.TxPool().SetMaxGas(gasCeil - params.SystemTxsGas) + } if err := ethBackend.StartMining(); err != nil { utils.Fatalf("Failed to start mining: %v", err) } diff --git a/cmd/geth/snapshot.go b/cmd/geth/snapshot.go index 61b38deddc..4409d21977 100644 --- a/cmd/geth/snapshot.go +++ b/cmd/geth/snapshot.go @@ -409,7 +409,7 @@ func pruneBlock(ctx *cli.Context) error { } if _, err := os.Stat(newAncientPath); err == nil { - // No file lock found for old ancientDB but new ancientDB exsisted, indicating the geth was interrupted + // No file lock found for old ancientDB but new ancientDB existed, indicating the geth was interrupted // after old ancientDB removal, this happened after backup successfully, so just rename the new ancientDB if err := blockpruner.AncientDbReplacer(); err != nil { log.Error("Failed to rename new ancient directory") diff --git a/core/blockchain.go b/core/blockchain.go index afe2971df6..ff4f66a471 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -71,6 +71,8 @@ var ( justifiedBlockGauge = metrics.NewRegisteredGauge("chain/head/justified", nil) finalizedBlockGauge = metrics.NewRegisteredGauge("chain/head/finalized", nil) + blockInsertMgaspsGauge = metrics.NewRegisteredGauge("chain/insert/mgasps", nil) + chainInfoGauge = metrics.NewRegisteredGaugeInfo("chain/info", nil) accountReadTimer = metrics.NewRegisteredTimer("chain/account/reads", nil) diff --git a/core/blockchain_insert.go b/core/blockchain_insert.go index 4777bff1ac..263074275b 100644 --- a/core/blockchain_insert.go +++ b/core/blockchain_insert.go @@ -58,11 +58,13 @@ func (st *insertStats) report(chain []*types.Block, index int, snapDiffItems, sn end := chain[index] // Assemble the log context and send it to the logger + mgasps := float64(st.usedGas) * 1000 / float64(elapsed) context := []interface{}{ "number", end.Number(), "hash", end.Hash(), "miner", end.Coinbase(), "blocks", st.processed, "txs", txs, "blobs", blobs, "mgas", float64(st.usedGas) / 1000000, - "elapsed", common.PrettyDuration(elapsed), "mgasps", float64(st.usedGas) * 1000 / float64(elapsed), + "elapsed", common.PrettyDuration(elapsed), "mgasps", mgasps, } + blockInsertMgaspsGauge.Update(int64(mgasps)) if timestamp := time.Unix(int64(end.Time()), 0); time.Since(timestamp) > time.Minute { context = append(context, []interface{}{"age", common.PrettyAge(timestamp)}...) } diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go index 834cbcd16e..e65c1b8929 100644 --- a/core/state/pruner/pruner.go +++ b/core/state/pruner/pruner.go @@ -402,7 +402,7 @@ func (p *BlockPruner) backUpOldDb(name string, cache, handles int, namespace str var oldOffSet uint64 if interrupt { - // The interrupt scecario within this function is specific for old and new ancientDB exsisted concurrently, + // The interrupt scecario within this function is specific for old and new ancientDB existed concurrently, // should use last version of offset for oldAncientDB, because current offset is // actually of the new ancientDB_Backup, but what we want is the offset of ancientDB being backup. oldOffSet = rawdb.ReadOffSetOfLastAncientFreezer(chainDb) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 792f851ee2..a30f0e1417 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -27,6 +27,7 @@ import ( "path/filepath" "sort" "sync" + "sync/atomic" "time" "github.com/ethereum/go-ethereum/common" @@ -305,6 +306,7 @@ type BlobPool struct { head *types.Header // Current head of the chain state *state.StateDB // Current state at the head of the chain gasTip *uint256.Int // Currently accepted minimum gas tip + maxGas atomic.Uint64 // Currently accepted max gas, it will be modified by MinerAPI lookup map[common.Hash]uint64 // Lookup table mapping hashes to tx billy entries index map[common.Address][]*blobTxMeta // Blob transactions grouped by accounts, sorted by nonce @@ -1098,6 +1100,7 @@ func (p *BlobPool) validateTx(tx *types.Transaction) error { Accept: 1 << types.BlobTxType, MaxSize: txMaxSize, MinTip: p.gasTip.ToBig(), + MaxGas: p.GetMaxGas(), } if err := txpool.ValidateTransaction(tx, p.head, p.signer, baseOpts); err != nil { return err @@ -1671,3 +1674,11 @@ func (p *BlobPool) Status(hash common.Hash) txpool.TxStatus { } return txpool.TxStatusUnknown } + +func (p *BlobPool) SetMaxGas(maxGas uint64) { + p.maxGas.Store(maxGas) +} + +func (p *BlobPool) GetMaxGas() uint64 { + return p.maxGas.Load() +} diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 0f3ce8d049..91cd01e7b4 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -219,6 +219,7 @@ type LegacyPool struct { scope event.SubscriptionScope signer types.Signer mu sync.RWMutex + maxGas atomic.Uint64 // Currently accepted max gas, it will be modified by MinerAPI currentHead atomic.Pointer[types.Header] // Current head of the blockchain currentState *state.StateDB // Current state in the blockchain head @@ -670,6 +671,7 @@ func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) erro 1< 0 && opts.MaxGas < tx.Gas() { + return ErrGasLimit + } + // Sanity check for extremely large numbers (supported by RLP or RPC) if tx.GasFeeCap().BitLen() > 256 { return core.ErrFeeCapVeryHigh diff --git a/eth/api_miner.go b/eth/api_miner.go index 764d0ae5e2..76398435c5 100644 --- a/eth/api_miner.go +++ b/eth/api_miner.go @@ -20,6 +20,8 @@ import ( "math/big" "time" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ) @@ -71,6 +73,9 @@ func (api *MinerAPI) SetGasPrice(gasPrice hexutil.Big) bool { // SetGasLimit sets the gaslimit to target towards during mining. func (api *MinerAPI) SetGasLimit(gasLimit hexutil.Uint64) bool { api.e.Miner().SetGasCeil(uint64(gasLimit)) + if api.e.Miner().Mining() && uint64(gasLimit) > params.SystemTxsGas { + api.e.TxPool().SetMaxGas(uint64(gasLimit) - params.SystemTxsGas) + } return true } diff --git a/go.mod b/go.mod index 6ff9d4e3e4..22c6c1ea3c 100644 --- a/go.mod +++ b/go.mod @@ -81,10 +81,10 @@ require ( github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.1.3 github.com/willf/bitset v1.1.3 go.uber.org/automaxprocs v1.5.2 - golang.org/x/crypto v0.19.0 + golang.org/x/crypto v0.21.0 golang.org/x/exp v0.0.0-20240213143201-ec583247a57a golang.org/x/sync v0.6.0 - golang.org/x/sys v0.17.0 + golang.org/x/sys v0.18.0 golang.org/x/text v0.14.0 golang.org/x/time v0.5.0 golang.org/x/tools v0.18.0 @@ -274,9 +274,9 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.23.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect - golang.org/x/term v0.17.0 // indirect + golang.org/x/term v0.18.0 // indirect google.golang.org/api v0.44.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect diff --git a/go.sum b/go.sum index 07635b0ee5..86de2ad1cb 100644 --- a/go.sum +++ b/go.sum @@ -1743,8 +1743,8 @@ golang.org/x/crypto v0.0.0-20210813211128-0a44fdfbc16e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1857,8 +1857,8 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -2007,13 +2007,13 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/miner/miner.go b/miner/miner.go index 665e409462..40503eb473 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -295,3 +295,7 @@ func (miner *Miner) SubscribePendingLogs(ch chan<- []*types.Log) event.Subscript func (miner *Miner) BuildPayload(args *BuildPayloadArgs) (*Payload, error) { return miner.worker.buildPayload(args) } + +func (miner *Miner) GasCeil() uint64 { + return miner.worker.getGasCeil() +} diff --git a/miner/worker.go b/miner/worker.go index ca866bc6e1..1677dc12b4 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -329,6 +329,12 @@ func (w *worker) setGasCeil(ceil uint64) { w.config.GasCeil = ceil } +func (w *worker) getGasCeil() uint64 { + w.mu.Lock() + defer w.mu.Unlock() + return w.config.GasCeil +} + // setExtra sets the content used to initialize the block extra field. func (w *worker) setExtra(extra []byte) { w.mu.Lock() diff --git a/params/config.go b/params/config.go index 6a2cd183b7..1c0b8fb175 100644 --- a/params/config.go +++ b/params/config.go @@ -147,13 +147,11 @@ var ( LondonBlock: big.NewInt(31302048), HertzBlock: big.NewInt(31302048), HertzfixBlock: big.NewInt(34140700), - // UnixTime: 1705996800 is January 23, 2024 8:00:00 AM UTC - ShanghaiTime: newUint64(1705996800), - KeplerTime: newUint64(1705996800), - FeynmanTime: newUint64(1713419340), - FeynmanFixTime: newUint64(1713419340), - // TODO(GalaIO): enable cancun fork time later - //CancunTime: newUint64(), + ShanghaiTime: newUint64(1705996800), // 2024-01-23 08:00:00 AM UTC + KeplerTime: newUint64(1705996800), // 2024-01-23 08:00:00 AM UTC + FeynmanTime: newUint64(1713419340), // 2024-04-18 05:49:00 AM UTC + FeynmanFixTime: newUint64(1713419340), // 2024-04-18 05:49:00 AM UTC + CancunTime: newUint64(1718863500), // 2024-06-20 06:05:00 AM UTC Parlia: &ParliaConfig{ Period: 3, diff --git a/params/version.go b/params/version.go index c2a2aedbcd..2bd4b9fe0d 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 4 // Minor version component of the current release - VersionPatch = 6 // Patch version component of the current release + VersionPatch = 7 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string ) diff --git a/trie/hbss2pbss.go b/trie/hbss2pbss.go index be7efa3a92..35402b5c7b 100644 --- a/trie/hbss2pbss.go +++ b/trie/hbss2pbss.go @@ -181,7 +181,7 @@ func (h2p *Hbss2Pbss) ConcurrentTraversal(theTrie *Trie, theNode node, path []by } } -// copy from trie/Commiter (*committer).commit +// copy from trie/Committer (*committer).commit func (h2p *Hbss2Pbss) commitChildren(path []byte, n *fullNode) [17]node { var children [17]node for i := 0; i < 16; i++ { diff --git a/triedb/pathdb/journal.go b/triedb/pathdb/journal.go index e14f047e0d..4fdcdd131e 100644 --- a/triedb/pathdb/journal.go +++ b/triedb/pathdb/journal.go @@ -195,7 +195,8 @@ func newJournalReader(file string, db ethdb.Database, journalType JournalType) ( // loadJournal tries to parse the layer journal from the disk. func (db *Database) loadJournal(diskRoot common.Hash) (layer, error) { start := time.Now() - reader, err := newJournalReader(db.config.JournalFilePath, db.diskdb, db.DetermineJournalTypeForReader()) + journalTypeForReader := db.DetermineJournalTypeForReader() + reader, err := newJournalReader(db.config.JournalFilePath, db.diskdb, journalTypeForReader) if err != nil { return nil, err @@ -226,12 +227,12 @@ func (db *Database) loadJournal(diskRoot common.Hash) (layer, error) { return nil, fmt.Errorf("%w want %x got %x", errUnmatchedJournal, root, diskRoot) } // Load the disk layer from the journal - base, err := db.loadDiskLayer(r) + base, err := db.loadDiskLayer(r, journalTypeForReader) if err != nil { return nil, err } // Load all the diff layers from the journal - head, err := db.loadDiffLayer(base, r) + head, err := db.loadDiffLayer(base, r, journalTypeForReader) if err != nil { return nil, err } @@ -262,14 +263,14 @@ func (db *Database) loadLayers() layer { // loadDiskLayer reads the binary blob from the layer journal, reconstructing // a new disk layer on it. -func (db *Database) loadDiskLayer(r *rlp.Stream) (layer, error) { +func (db *Database) loadDiskLayer(r *rlp.Stream, journalTypeForReader JournalType) (layer, error) { // Resolve disk layer root var ( root common.Hash journalBuf *rlp.Stream journalEncodedBuff []byte ) - if db.DetermineJournalTypeForReader() == JournalFileType { + if journalTypeForReader == JournalFileType { if err := r.Decode(&journalEncodedBuff); err != nil { return nil, fmt.Errorf("load disk journal: %v", err) } @@ -310,7 +311,7 @@ func (db *Database) loadDiskLayer(r *rlp.Stream) (layer, error) { nodes[entry.Owner] = subset } - if db.DetermineJournalTypeForReader() == JournalFileType { + if journalTypeForReader == JournalFileType { var shaSum [32]byte if err := r.Decode(&shaSum); err != nil { return nil, fmt.Errorf("load shasum: %v", err) @@ -329,14 +330,14 @@ func (db *Database) loadDiskLayer(r *rlp.Stream) (layer, error) { // loadDiffLayer reads the next sections of a layer journal, reconstructing a new // diff and verifying that it can be linked to the requested parent. -func (db *Database) loadDiffLayer(parent layer, r *rlp.Stream) (layer, error) { +func (db *Database) loadDiffLayer(parent layer, r *rlp.Stream, journalTypeForReader JournalType) (layer, error) { // Read the next diff journal entry var ( root common.Hash journalBuf *rlp.Stream journalEncodedBuff []byte ) - if db.DetermineJournalTypeForReader() == JournalFileType { + if journalTypeForReader == JournalFileType { if err := r.Decode(&journalEncodedBuff); err != nil { // The first read may fail with EOF, marking the end of the journal if err == io.EOF { @@ -409,7 +410,7 @@ func (db *Database) loadDiffLayer(parent layer, r *rlp.Stream) (layer, error) { storages[entry.Account] = set } - if db.DetermineJournalTypeForReader() == JournalFileType { + if journalTypeForReader == JournalFileType { var shaSum [32]byte if err := r.Decode(&shaSum); err != nil { return nil, fmt.Errorf("load shasum: %v", err) @@ -423,7 +424,7 @@ func (db *Database) loadDiffLayer(parent layer, r *rlp.Stream) (layer, error) { log.Debug("Loaded diff layer journal", "root", root, "parent", parent.rootHash(), "id", parent.stateID()+1, "block", block) - return db.loadDiffLayer(newDiffLayer(parent, root, parent.stateID()+1, block, nodes, triestate.New(accounts, storages, incomplete)), r) + return db.loadDiffLayer(newDiffLayer(parent, root, parent.stateID()+1, block, nodes, triestate.New(accounts, storages, incomplete)), r, journalTypeForReader) } // journal implements the layer interface, marshaling the un-flushed trie nodes