From eae46f7d3649804f4f95e602cd96b74c351accd0 Mon Sep 17 00:00:00 2001 From: VM Date: Mon, 9 Sep 2024 21:32:46 +0800 Subject: [PATCH] test: fix pathdb unit test --- cmd/utils/flags.go | 1 - triedb/pathdb/asyncnodebuffer.go | 2 +- triedb/pathdb/history.go | 6 ------ triedb/pathdb/nodebufferlist.go | 2 +- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 1cf86b5839..e9d52c972b 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -35,7 +35,6 @@ import ( "time" "github.com/ethereum/go-ethereum/core/txpool/bundlepool" - pcsclite "github.com/gballet/go-libpcsclite" gopsutil "github.com/shirou/gopsutil/mem" "github.com/urfave/cli/v2" diff --git a/triedb/pathdb/asyncnodebuffer.go b/triedb/pathdb/asyncnodebuffer.go index 61d130ce93..c9363348c0 100644 --- a/triedb/pathdb/asyncnodebuffer.go +++ b/triedb/pathdb/asyncnodebuffer.go @@ -344,7 +344,7 @@ func (nc *nodecache) flush(db ethdb.KeyValueStore, clean *fastcache.Cache, id ui commitBytesMeter.Mark(int64(size)) commitNodesMeter.Mark(int64(nodes)) commitTimeTimer.UpdateSince(start) - log.Info("Persisted pathdb nodes 2222", "nodes", len(nc.nodes), "bytes", common.StorageSize(size), "elapsed", common.PrettyDuration(time.Since(start))) + log.Debug("Persisted pathdb nodes", "nodes", len(nc.nodes), "bytes", common.StorageSize(size), "elapsed", common.PrettyDuration(time.Since(start))) nc.reset() return nil } diff --git a/triedb/pathdb/history.go b/triedb/pathdb/history.go index f54774f3cb..f6f6217552 100644 --- a/triedb/pathdb/history.go +++ b/triedb/pathdb/history.go @@ -517,7 +517,6 @@ func (h *history) decode(accountData, storageData, accountIndexes, storageIndexe func (h *history) Size() int { size := 0 - // calculate size of meta if h.meta != nil { metaSize := 1 metaSize += len(h.meta.parent) + len(h.meta.root) @@ -526,25 +525,20 @@ func (h *history) Size() int { size += metaSize } - // calculate size of accounts for address, data := range h.accounts { size += len(address) size += len(data) } - // calculate size of accountList size += len(h.accountList) * common.AddressLength - // calculate size of storages for _, storage := range h.storages { for slotHash, data := range storage { size += len(slotHash) size += len(data) } } - // calculate size of storageList for _, slots := range h.storageList { size += len(slots) * common.HashLength } - // calculate size of journalNodes for _, jn := range h.nodes { size += common.AddressLength for _, n := range jn.Nodes { diff --git a/triedb/pathdb/nodebufferlist.go b/triedb/pathdb/nodebufferlist.go index 7defd1b691..547b4c3a9f 100644 --- a/triedb/pathdb/nodebufferlist.go +++ b/triedb/pathdb/nodebufferlist.go @@ -1096,7 +1096,7 @@ func (mf *multiDifflayer) flush(db ethdb.KeyValueStore, clean *fastcache.Cache, commitBytesMeter.Mark(int64(size)) commitNodesMeter.Mark(int64(nodes)) commitTimeTimer.UpdateSince(start) - log.Info("Persisted pathdb nodes 1111", "nodes", len(mf.nodes), "bytes", common.StorageSize(size), "state_id", id, "elapsed", common.PrettyDuration(time.Since(start))) + log.Info("Persisted pathdb nodes", "nodes", len(mf.nodes), "bytes", common.StorageSize(size), "state_id", id, "elapsed", common.PrettyDuration(time.Since(start))) return nil }