Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev 0.10.2 #1

Merged
merged 219 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
219 commits
Select commit Hold shift + click to select a range
55430b6
trie: implement NodeBlob API for trie iterator
rjl493456442 Feb 15, 2022
2056e59
params: begin v1.10.17 release cycle
holiman Feb 15, 2022
4d08643
core, ethdb, tests, trie: implement NewBatchWithSize API for batcher …
rjl493456442 Feb 15, 2022
fc8ad1b
Merge pull request #24391 from rjl493456442/trie-iterator
karalabe Feb 15, 2022
bb45446
core, ethdb, tests, trie: implement NewBatchWithSize API for batcher …
rjl493456442 Feb 15, 2022
2f32bf7
trie: implement NodeBlob API for trie iterator(merge)
cp-wjhan Nov 11, 2022
d6118d3
build: disable Ubuntu Hirsuite (#24408)
holiman Feb 16, 2022
6916296
rlp/rlpgen: RLP encoder code generator (#24251)
fjl Feb 16, 2022
a498329
build: add Ubuntu 21.10 PPA target (#24418)
fjl Feb 17, 2022
666335a
core/types: faster RLP encoding of Header, StateAcccount, ReceiptForS…
fjl Feb 18, 2022
db8e5b1
graphql: fix nonce for pending accounts (#24443)
s1na Feb 22, 2022
9be142b
params: replace 2 bootnodes (#24432)
holiman Feb 23, 2022
8d2262f
rlp: add WriteString method on EncoderBuffer (#24425)
ucwong Feb 24, 2022
fcccd09
appveyor.yml: fetch sub-modules recursively (#24451)
gurukamath Mar 1, 2022
6471aed
les/vflux/client: fix goroutine leak in testIter (#24449)
zsfelfoldi Mar 1, 2022
670a462
README.md: add hardware requirements (#24395)
YashAtwal Mar 1, 2022
713b098
rpc: fix godoc (#24488)
s7v7nislands Mar 2, 2022
8ed6c77
internal/build: switch azure sdk from Azure/azure-storage-blob-go to …
uji Mar 2, 2022
7753c57
signer/fourbyte: add support for nested types in selectors (#24407)
danhper Mar 4, 2022
cd3b017
cmd/geth, node, rpc: implement jwt tokens (#24364)
holiman Mar 7, 2022
3b17942
cmd: allow file descriptor limit to be set via CLI (#24477)
ohe Mar 7, 2022
b635759
crypto/bls12381: fix typo in comment (#24509)
eltociear Mar 8, 2022
bdca199
core/statedb: always clear out access list when setting a new one
karalabe Mar 8, 2022
55fc626
crypto/bn256/cloudflare: fix asm for dynamic linking (#24476)
uji Mar 8, 2022
e677232
core/rawdb: add HasCode, HashTrieNode and use them where possible (#2…
ceyonur Mar 8, 2022
141bb9c
mobile: remove deprecated Stop function (#24369)
n1charlie Mar 8, 2022
f36ac20
core/types: improve error for too short transaction / receipt encodin…
Juicestus Mar 9, 2022
835652e
rlp, trie: faster trie node encoding (#24126)
qianbin Mar 9, 2022
8bf02ee
trie:fix make lint error
cp-wjhan Nov 15, 2022
4b5594e
cmd/geth: make authrpc listening address settable from command line (…
fjl Mar 9, 2022
09368ea
core, ethdb, tests, trie: introduce database snapshot (#24486)
rjl493456442 Mar 10, 2022
1506db8
core/rawdb, cmd, ethdb, eth: implement freezer tail deletion (#23954)
rjl493456442 Mar 10, 2022
9863f47
eth/protocols/snap: avoid estimating infinite percentage
holiman Mar 10, 2022
40a5c5e
graphql: fee history fields (#24452)
s1na Mar 10, 2022
8a1af0d
eth/protocols/snap: a little typo Merkel -> Merkle (#24530)
myself659 Mar 11, 2022
14195fc
eth/downloader: implement beacon sync (#23982)
karalabe Mar 11, 2022
568ecdd
rpc: fix defer in test (#24490)
s7v7nislands Mar 11, 2022
1b37fe3
go.mod: upgrade upnp dependency (#24536)
ucwong Mar 14, 2022
67a093e
core/rawdb: add specified key length iterator (#24535)
aaronbuchwald Mar 15, 2022
0a9b251
trie: fix two issues in trie iterator (#24539)
rjl493456442 Mar 15, 2022
e0b7524
build: fix linter install on windows (#24523)
ligi Mar 15, 2022
26cc742
eth/tracers: use hex encoding for debug_traceBlock argument (#24517)
guifel Mar 15, 2022
e0b72c8
cmd/geth: set EnableBashCompletion = true (#24313)
ligi Mar 15, 2022
569322f
cmd/geth: rename --whitelist to --eth.requiredblocks (#24505)
ryanschneider Mar 15, 2022
ac4fc56
eth/downloader: fix off-by-one error in test causing 50% fails
karalabe Mar 16, 2022
1add6c5
les, tests: fix vflux fuzzer by removing unnecessary panic (#24537)
rjl493456442 Mar 16, 2022
b2c4609
crypto: use btcec/v2 for no-cgo (#24533)
chappjc Mar 16, 2022
dc26b79
core: eth: implement Kiln-v2 spec (#24506)
MariusVanDerWijden Mar 17, 2022
7f4b4da
core, params: add kiln flag (#24548)
MariusVanDerWijden Mar 17, 2022
10cf085
docs/postmortems: fix spelling (#24558)
alvaroahp11 Mar 18, 2022
123b119
eth/downloader: terminate beacon sync early when linked to local chai…
karalabe Mar 21, 2022
3a4f89f
core/rawdb: fix db commands (#24540)
rjl493456442 Mar 22, 2022
ee04a25
crypto/bls12381: go format
ucwong Mar 22, 2022
51f3723
core: store genesis allocation and recommit them if necessary (#24460)
rjl493456442 Mar 22, 2022
26c43a2
eth/downloader: ignore zero size header batch for importing (#24569)
rjl493456442 Mar 22, 2022
8c478b0
core/rawdb: simple legacy receipt converter (#24028)
s1na Mar 23, 2022
3d12fc1
eth/downloader: fix flakey test (#24576)
holiman Mar 23, 2022
7eebcf5
eth/catalyst: fix log message (#24574)
MariusVanDerWijden Mar 23, 2022
246da28
node: allow JWT pass by file only (#24579)
MariusVanDerWijden Mar 24, 2022
1fcc014
internal/build: show ppa upload process stdout on stdout (#24588)
holiman Mar 25, 2022
b77f300
internal/build: prevent travis timeout during ppa upload (#24589)
holiman Mar 25, 2022
31dc97f
internal/build: exit sftp upload (#24590)
holiman Mar 25, 2022
cd7461e
build: close sftp connection when done (#24593)
holiman Mar 27, 2022
f462413
core: set ttd override on all chain variations
karalabe Mar 29, 2022
0fa5518
core/vm: fix sstore gas comment type (#24583)
lispc Mar 29, 2022
3ee98b7
cmd/geth: change to non-fatal error message when legacy receipt stora…
jwasinger Mar 29, 2022
32dacc1
eth/catalyst: only apply block if we actually have the state (#24598)
MariusVanDerWijden Mar 29, 2022
74cb266
ethdb: update rocksdb snapshot, batch
cp-jhjin Nov 18, 2022
8d33e21
core/types:fix run error(regenerated gen_header_rlp.go)
cp-wjhan Nov 21, 2022
95bf414
miner: fetch the pending transaction only once
cp-jhjin Jan 10, 2023
eb28145
Merge pull request #26 from cp-yoonjin/dev_ethV1.10.17
sadoci Jan 26, 2023
7ad22eb
rlp: fix typo in comment (#24595)
flowerofdream Mar 29, 2022
b034ce3
core/state/snapshot: clean up the generation code (#24479)
rjl493456442 Mar 29, 2022
8aac390
go.mod : upnp 1.0.3 stable version (#24573)
ucwong Mar 29, 2022
8e24806
internal/ethapi: add refund to StructLogRes (#24567)
lispc Mar 29, 2022
0c2b4ea
eth/tracers/logger: use omitempty to reduce log bloat (#24547)
holiman Mar 29, 2022
44c91b2
common/compiler: add extra include paths to solidity compiler (#24541)
zhiqiangxu Mar 29, 2022
981b7d3
core: verify genesis extradata for clique (#24470)
gurukamath Mar 30, 2022
230dbca
eth: change snapshot extension registration failure to warning instea…
nicjansma Mar 30, 2022
7f4bdfc
trie, les, tests, core: implement trie tracer (#24403)
rjl493456442 Mar 31, 2022
f156c5e
core,eth: implement tx-level hooks for tracers (#24510)
s1na Mar 31, 2022
c91e9de
eth: clarify the error string on getlogs failure (#24617)
holiman Mar 31, 2022
f4eda3f
eth/downloader: retrieve pivot header from local chain if necessary (…
rjl493456442 Apr 4, 2022
05d2352
README: update free space required (#24636)
adlerjohn Apr 5, 2022
df027cf
rpc: fixed a typo (#24642)
tacoo Apr 5, 2022
e6e857f
eth/fetcher: if peers never respond, drop them
karalabe Apr 6, 2022
3696098
eth/tracers: refactor traceTx to separate out struct logging (#24326)
s1na Apr 6, 2022
375fc6b
core/state/snapshot: remove noop map item assignment
karalabe Apr 7, 2022
a1d5c99
cmd/geth: inspect snapshot dangling storage (#24643)
holiman Apr 8, 2022
fc15a03
accounts/abi: handle tuple arrays in ParseSelector (#24587)
tclairet Apr 8, 2022
f64247b
all: use T.TempDir to create temporary test directories (#24633)
Juneezee Apr 8, 2022
357940e
les: fix panic in ultralight client sync (#24641)
rjl493456442 Apr 8, 2022
c4172dd
log: modify lock defer unlock order in sync handler (#24667)
aaronbuchwald Apr 8, 2022
ccdca04
build/deb: update Debian control file to remove unencrypted git proto…
krvaibhaw Apr 11, 2022
9d93bcc
core/types: make "miner" optional in Header JSON (#24666)
fjl Apr 11, 2022
8fcdce1
cmd: set DefaultGasLimit to 30M (#24680)
MariusVanDerWijden Apr 12, 2022
842e563
core: fix benchmark panic (#24657)
rjl493456442 Apr 12, 2022
57e31b4
abi/base: return error for pending call error (#24649)
JoeGruffins Apr 12, 2022
924c72c
build: add imports for go generate tools (#24682)
ucwong Apr 12, 2022
4534c86
eth/tracers: make txhash blockhash accessible to native tracers (#24679)
s1na Apr 12, 2022
c847f67
cmd/geth: support bigints for --override.terminaltotaldifficulty (#24…
MariusVanDerWijden Apr 13, 2022
5dd425f
eth/downloader: remove stale beacon headers as backfilling progresses…
karalabe Apr 13, 2022
f517dec
eth/downloader: resolve local header by hash for beacon sync (#24691)
rjl493456442 Apr 14, 2022
2a7a124
eth/downloader:fix skeleton text
cp-wjhan Nov 29, 2022
aa25839
go.mod: upgrade btcec and add 'chainhash' module requirement (#24700)
fjl Apr 17, 2022
6e7e868
trie: remove unused makeHashNode (#24702)
darioush Apr 20, 2022
744c36e
core/vm: fix typo (#24714)
Evalir Apr 20, 2022
c86a7aa
eth/downloader: fix typo in downloader.go (#24704)
eltociear Apr 20, 2022
0e269db
eth/tracers/logger: remove unnecessary comparisons in accessList.equa…
Apr 21, 2022
d39ef2f
README.md: update Go min required version to 1.16 (#24713)
koosha-- Apr 21, 2022
df8a5e4
.github: update CODEOWNERS (#24743)
fjl Apr 23, 2022
0142c06
internal/flags: fix godoc (#24734)
s7v7nislands Apr 23, 2022
c301e33
cmd/faucet: fix genesis flag and improve documentation (#24735)
s7v7nislands Apr 23, 2022
2ea56cc
cmd/evm: ensure input length is even (#24721)
jwasinger Apr 25, 2022
e600bd3
fix typo (#24731)
s7v7nislands Apr 25, 2022
2a1b48b
mobile: fix receipt encoding to json (#24701)
enginegl Apr 25, 2022
bc8e686
p2p: fix type of DiscSubprotocolError (#24747)
henopied Apr 25, 2022
54ec1fa
all: use 'embed' instead of go-bindata (#24744)
s7v7nislands Apr 25, 2022
da6ecd4
cmd/geth, core/state/snapshot: fix flaw in dangling-storage check + i…
holiman Apr 26, 2022
a2652e4
cmd/*: refactor get flag value (#24761)
s7v7nislands Apr 26, 2022
2b48602
consensus/ethash: fix typos in var names (#24745)
john-difool Apr 26, 2022
f7c87f6
internal/ethapi: add db operations to api (#24739)
s1na Apr 27, 2022
2187ac5
core/types: fix unhandled errors in TestTransactionCoding (#24692)
tia-99 Apr 27, 2022
1e15ffd
cmd/utils: utilize beacon wrapper in makechain (#24620)
holiman Apr 27, 2022
504b978
all: use common.FileExist for checking file existence (#24748)
s7v7nislands Apr 27, 2022
c5a6e66
ethclient/gethclient: return storage proofs in GetProof (#24697)
trianglesphere Apr 27, 2022
75b5983
eth/filters: remove unused struct fields (#24782)
hero5512 Apr 29, 2022
94bc16e
cmd/clef: fixups to the python clef poc (#24440)
holiman May 2, 2022
f6f1faa
cmd/evm: make evm t8n handle post-merge transitions (#24546)
holiman May 2, 2022
e2768ca
cmd: group network and db path flags together (#24698)
rjl493456442 May 3, 2022
f96abd7
accounts: fix typo in comments (#24805)
nujabes403 May 3, 2022
b5dab1d
docker: speed up docker image build (#24796)
eval-exec May 3, 2022
baa5c5b
cmd/utils: double limit on free-disk monitor (#24781)
holiman May 3, 2022
64e4582
build: fix formatted logs (#24807)
freaker2k7 May 3, 2022
19d420d
build: ppa build for jammy (ubuntu 22.04)
holiman May 4, 2022
332cc70
graphql: add rawReceipt field to transaction type (#24738)
s1na May 4, 2022
5cbf639
eth/filters: fix code comment (#24799)
eval-exec May 4, 2022
0fdcb8d
cmd/geth: fix init genesis for dev (#24693)
s1na May 4, 2022
8656a57
cmd, eth: fix required blocks regression
karalabe May 4, 2022
0519d07
core: fix WriteBlockAndSetHead documentation (#24818)
milesvant May 5, 2022
a33aded
core: recover state when beacon sets canonical head if it's missing (…
rjl493456442 May 5, 2022
0f457d7
eth/protocols/eth: fix godoc comments (#24810)
s7v7nislands May 5, 2022
66f400b
eth/filters: remove explicit continue label in filterLogs (#24795)
eval-exec May 5, 2022
d5944c4
p2p/simulations: escape mockerType value from request (#24822)
ImanSharaf May 5, 2022
3e4096c
p2p/simulations: fix typo in network_test.go (#24824)
eltociear May 5, 2022
494cfae
miner: discard interrupted blocks (#24638)
Ruteri May 6, 2022
8e27cc9
core/rawdb: untie freezer and ancient chain data (#24684)
rjl493456442 May 6, 2022
48b757e
core/vm: implement EIP-3855: PUSH0 instruction (#24039)
axic May 6, 2022
7468e71
eth/fetcher: avoid hang in tests (partial fix for #23331) (#23351)
holiman May 6, 2022
217243f
signer/fourbyte: import new signatures (#22865)
holiman May 6, 2022
d4e5326
abi: fix checks when all fields are indexed (#24792)
rachel-bousfield May 6, 2022
9145172
core/state/snapshot: fix race condition (#24685)
MariusVanDerWijden May 6, 2022
0080287
all: replace strings.Replace with string.ReplaceAll (#24835)
s7v7nislands May 9, 2022
4c01855
internal: drop TestSignCliqueBlock (#24837)
s1na May 10, 2022
6183ed1
signer/fourbyte: remove offending signatures (#24842)
holiman May 10, 2022
e6692a2
eth/protocols/snap: sort trienode heal requests by path (#24779)
holiman May 10, 2022
89f6913
cmd/geth: print info banner for --dev mode (#24759)
nedifi May 10, 2022
74a1e32
core/vm: clean up some dead functions (#24851)
s7v7nislands May 11, 2022
ec43348
core/vm: separate opcode group for 0x20 range (#24850)
s7v7nislands May 11, 2022
eefb832
ethclient: add PeerCount method (#24849)
FelStroz May 11, 2022
3bf164d
core/vm: optimize Memory.Set32 (#24847)
qianbin May 11, 2022
6c7aa4e
graphql: fix long literal passed in a variable (#24864)
s1na May 12, 2022
18065a3
core/vm: for tracing, do not report post-op memory
holiman May 12, 2022
e5b2930
internal/ethapi: add debug_getRawReceipts RPC method (#24773)
ryanschneider May 14, 2022
c20846a
params: set ropsten TTD for TheMerge (#24876)
MariusVanDerWijden May 16, 2022
b72e7a0
cmd/utils: add deprecation warning for Rinkeby
karalabe May 16, 2022
4cfad0c
core/asm: use strings.Builder and fix godoc issues (#24861)
s7v7nislands May 16, 2022
e1e8f7b
all: replace uses of ioutil with io and os (#24869)
estensen May 16, 2022
0451c6a
all: fix error and more replace uses of ioutil with io and os
cp-wjhan Dec 1, 2022
14b941e
cmd/geth: update vulnerabilities.json testdata (#24856)
holiman May 16, 2022
c3f1637
core/vm: reduce overhead in instructions-benchmark (#24860)
qianbin May 17, 2022
e0890c4
eth: fix flaky test, don't attach empty slots/proofs (#24885)
rjl493456442 May 17, 2022
a7f09bb
graphql: add raw fields to block and tx (#24816)
s1na May 17, 2022
3484156
eth/catalyst: set the correct LatestValidHash (#24855)
MariusVanDerWijden May 17, 2022
c80157f
cmd/geth: add `db check-state-content` to verify integrity of trie no…
holiman May 17, 2022
08d1d84
all: use strings.EqualFold for string comparison (#24890)
estensen May 17, 2022
35fbc8f
all: replace non-trivial uses of package ioutil with os (#24886)
estensen May 17, 2022
ffec96f
accounts/keystore: fix build error(all: replace non-trivial uses of p…
cp-wjhan Dec 1, 2022
d759c9c
ethdb/remotedb, cmd: add support for remote (readonly) databases (#24…
holiman May 18, 2022
61aa943
core, eth, internal, rpc: implement final block (#24282)
MariusVanDerWijden May 18, 2022
083822b
eth/catalyst, miner: build the execution payload async (#24866)
MariusVanDerWijden May 18, 2022
860f7ba
eth/tracers/js: goja tracer (#23773)
s1na May 18, 2022
fc9a233
params: update goerli bootnodes (#24900)
q9f May 18, 2022
ca35163
params: fix broken linter
karalabe May 18, 2022
4d964e9
ethdb/remotedb: fix flawed check in Has/HasAncient
holiman May 18, 2022
1bff85a
core: fix the order of address in queue (#24907)
zhaochonghe May 19, 2022
37ca2b1
tests: update reference tests (#24899)
holiman May 19, 2022
75f3bb8
eth/tracers/js: add memory.length method (#24887)
ed255 May 19, 2022
3e1ebb5
eth/catalyst: update implementation to spec (#24802)
MariusVanDerWijden May 20, 2022
05a927c
eth/catalyst:fix go lint error
cp-wjhan Dec 2, 2022
010f2c1
core, eth, les, rpc: polish catalyst errors, add context
karalabe May 20, 2022
4f00d95
build/bot: add mac build script (#24917)
fjl May 20, 2022
f0619ab
build/bot: remove xctool invocation in macos build script (#24918)
fjl May 20, 2022
724696d
build/bot: add ppa-build.sh (#24919)
fjl May 20, 2022
135addc
build/bot: avoid install of python-bzrlib, python-paramiko in PPA bui…
fjl May 20, 2022
d71cc7a
build/bot: create .ssh directory in ppa-build.sh (#24922)
fjl May 20, 2022
0beca28
core/state/snapshot: detect and clean up dangling storage snapshot in…
rjl493456442 May 23, 2022
434c2d3
accounts/abi: validate fieldnames, fixes #24930 (#24932)
holiman May 23, 2022
b7631a9
common/compiler, cmd/abigen: remove solc/vyper compiler integration
holiman May 23, 2022
043025f
eth/tracers/js: drop duktape engine (#24934)
s1na May 23, 2022
d710bcd
signer/core: always pad clique header extra data with space for seale…
jwasinger May 24, 2022
81da8e8
go.mod: upgrade to btcsuite/btcd/btcec v2.2.0 (#24939)
fjl May 24, 2022
07a2df2
params: update CHTs for Geth 1.10.18
karalabe May 24, 2022
0f1a6e6
all: update license headers and AUTHORS from git history (#24947)
fjl May 24, 2022
62c261c
AUTHORS: remove one more duplicate entry (#24950)
fjl May 24, 2022
18e1b1f
go.mod: upgrade to docker v1.6.2 (#24956)
fjl May 25, 2022
53d0c1f
fix initial snapshot generate error in rocksdb
cp-wjhan Dec 29, 2022
60f38b9
gwemix.sh: check if mining is in progress during stopping
saddoc Feb 3, 2023
7dad7ca
Makefile: build rocksdb with PORTABLE=1
sadoci Feb 8, 2023
5a04fad
Make TriesInMemory configurable through CLI config
FabricPark Feb 23, 2023
5bb15b9
params: Gwemix v0.10.2
sadoci Feb 24, 2023
269b344
wemix: remove auto-etcdInit() for bootnode
cp-jhjin Feb 24, 2023
8164f3c
Merge pull request #32 from cp-yoonjin/dev-0.10.2
cp-khs Feb 24, 2023
13ea346
Merge branch 'dev' into master
sadoci Feb 28, 2023
27c70b9
Merge pull request #33 from FabricPark/master
sadoci Feb 28, 2023
b457789
cmd, core: fixes for lint & test
saddoc Feb 28, 2023
68d3ef9
Merge dev into dev-0.10.2
saddoc Feb 28, 2023
3e9e163
eth/ethconfig: Update 'TxLookupLimit' default value to match the bloc…
cp-jhjin Mar 6, 2023
e2e963d
Merge pull request #34 from cp-yoonjin/dev-0.10.2
cp-khs Mar 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions trie/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ type NodeIterator interface {
// For leaf nodes, the last element of the path is the 'terminator symbol' 0x10.
Path() []byte

// NodeBlob returns the rlp-encoded value of the current iterated node.
// If the node is an embedded node in its parent, nil is returned then.
NodeBlob() []byte

// Leaf returns true iff the current node is a leaf node.
Leaf() bool

Expand Down Expand Up @@ -224,6 +228,18 @@ func (it *nodeIterator) Path() []byte {
return it.path
}

func (it *nodeIterator) NodeBlob() []byte {
if it.Hash() == (common.Hash{}) {
return nil // skip the non-standalone node
}
blob, err := it.resolveBlob(it.Hash().Bytes(), it.Path())
if err != nil {
it.err = err
return nil
}
return blob
}

func (it *nodeIterator) Error() error {
if it.err == errIteratorEnd {
return nil
Expand Down Expand Up @@ -362,6 +378,15 @@ func (it *nodeIterator) resolveHash(hash hashNode, path []byte) (node, error) {
return resolved, err
}

func (it *nodeIterator) resolveBlob(hash hashNode, path []byte) ([]byte, error) {
if it.resolver != nil {
if blob, err := it.resolver.Get(hash); err == nil && len(blob) > 0 {
return blob, nil
}
}
return it.trie.resolveBlob(hash, path)
}

func (st *nodeIteratorState) resolve(it *nodeIterator, path []byte) error {
if hash, ok := st.node.(hashNode); ok {
resolved, err := it.resolveHash(hash, path)
Expand Down Expand Up @@ -549,6 +574,10 @@ func (it *differenceIterator) Path() []byte {
return it.b.Path()
}

func (it *differenceIterator) NodeBlob() []byte {
return it.b.NodeBlob()
}

func (it *differenceIterator) AddResolver(resolver ethdb.KeyValueReader) {
panic("not implemented")
}
Expand Down Expand Up @@ -660,6 +689,10 @@ func (it *unionIterator) Path() []byte {
return (*it.items)[0].Path()
}

func (it *unionIterator) NodeBlob() []byte {
return (*it.items)[0].NodeBlob()
}

func (it *unionIterator) AddResolver(resolver ethdb.KeyValueReader) {
panic("not implemented")
}
Expand Down
51 changes: 51 additions & 0 deletions trie/iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,54 @@ func TestNodeIteratorLargeTrie(t *testing.T) {
t.Fatalf("Too many lookups during seek, have %d want %d", have, want)
}
}

func TestIteratorNodeBlob(t *testing.T) {
var (
db = memorydb.New()
triedb = NewDatabase(db)
trie, _ = New(common.Hash{}, triedb)
)
vals := []struct{ k, v string }{
{"do", "verb"},
{"ether", "wookiedoo"},
{"horse", "stallion"},
{"shaman", "horse"},
{"doge", "coin"},
{"dog", "puppy"},
{"somethingveryoddindeedthis is", "myothernodedata"},
}
all := make(map[string]string)
for _, val := range vals {
all[val.k] = val.v
trie.Update([]byte(val.k), []byte(val.v))
}
trie.Commit(nil)
triedb.Cap(0)

found := make(map[common.Hash][]byte)
it := trie.NodeIterator(nil)
for it.Next(true) {
if it.Hash() == (common.Hash{}) {
continue
}
found[it.Hash()] = it.NodeBlob()
}

dbIter := db.NewIterator(nil, nil)
defer dbIter.Release()

var count int
for dbIter.Next() {
got, present := found[common.BytesToHash(dbIter.Key())]
if !present {
t.Fatalf("Miss trie node %v", dbIter.Key())
}
if !bytes.Equal(got, dbIter.Value()) {
t.Fatalf("Unexpected trie node want %v got %v", dbIter.Value(), got)
}
count += 1
}
if count != len(found) {
t.Fatal("Find extra trie node via iterator")
}
}
9 changes: 9 additions & 0 deletions trie/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,15 @@ func (t *Trie) resolveHash(n hashNode, prefix []byte) (node, error) {
return nil, &MissingNodeError{NodeHash: hash, Path: prefix}
}

func (t *Trie) resolveBlob(n hashNode, prefix []byte) ([]byte, error) {
hash := common.BytesToHash(n)
blob, _ := t.db.Node(hash)
if len(blob) != 0 {
return blob, nil
}
return nil, &MissingNodeError{NodeHash: hash, Path: prefix}
}

// Hash returns the root hash of the trie. It does not write to the
// database and can be used even if the trie doesn't have one.
func (t *Trie) Hash() common.Hash {
Expand Down