core: use TryGetAccount to read what TryUpdateAccount has written (#25458)

* core: use TryGetAccount to read where TryUpdateAccount has been used to write

* Gary's review feedback

* implement Gary's suggestion

* fix bug + rename NewSecure into NewStateTrie

* trie: add backwards-compatibility aliases for SecureTrie

* Update database.go

* make the linter happy

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
This commit is contained in:
Guillaume Ballet
2022-08-04 16:13:18 +02:00
committed by GitHub
co-authored by Felix Lange rjl493456442
parent 8b53b92eb4
commit f67e54c92f
18 changed files with 142 additions and 88 deletions
+2 -2
View File
@@ -529,11 +529,11 @@ func (l *loggingDb) Close() error {
}
// makeLargeTestTrie create a sample test trie
func makeLargeTestTrie() (*Database, *SecureTrie, *loggingDb) {
func makeLargeTestTrie() (*Database, *StateTrie, *loggingDb) {
// Create an empty trie
logDb := &loggingDb{0, memorydb.New()}
triedb := NewDatabase(logDb)
trie, _ := NewSecure(common.Hash{}, common.Hash{}, triedb)
trie, _ := NewStateTrie(common.Hash{}, common.Hash{}, triedb)
// Fill it with some arbitrary data
for i := 0; i < 10000; i++ {