aboutsummaryrefslogtreecommitdiffstats
path: root/trie
diff options
context:
space:
mode:
authorS. Matthew English <s-matthew-english@users.noreply.github.com>2017-06-12 20:45:17 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-06-12 20:45:17 +0800
commit061889d4ea13b23d777efbe005210ead8667e869 (patch)
tree35a391e5ac09e683796c3c698f36542f06803d03 /trie
parente3dfd5582026a8744a80d3de407601526b720abb (diff)
downloadgo-tangerine-061889d4ea13b23d777efbe005210ead8667e869.tar.gz
go-tangerine-061889d4ea13b23d777efbe005210ead8667e869.tar.zst
go-tangerine-061889d4ea13b23d777efbe005210ead8667e869.zip
rlp, trie, contracts, compression, consensus: improve comments (#14580)
Diffstat (limited to 'trie')
-rw-r--r--trie/hasher.go2
-rw-r--r--trie/secure_trie_test.go2
-rw-r--r--trie/sync_test.go6
-rw-r--r--trie/trie.go6
4 files changed, 8 insertions, 8 deletions
diff --git a/trie/hasher.go b/trie/hasher.go
index 85b6b60f5..672456e2d 100644
--- a/trie/hasher.go
+++ b/trie/hasher.go
@@ -50,7 +50,7 @@ func returnHasherToPool(h *hasher) {
}
// hash collapses a node down into a hash node, also returning a copy of the
-// original node initialzied with the computed hash to replace the original one.
+// original node initialized with the computed hash to replace the original one.
func (h *hasher) hash(n node, db DatabaseWriter, force bool) (node, node, error) {
// If we're not storing the node, just hashing, use available cached data
if hash, dirty := n.cache(); hash != nil {
diff --git a/trie/secure_trie_test.go b/trie/secure_trie_test.go
index 159640fda..d74102e2a 100644
--- a/trie/secure_trie_test.go
+++ b/trie/secure_trie_test.go
@@ -51,7 +51,7 @@ func makeTestSecureTrie() (ethdb.Database, *SecureTrie, map[string][]byte) {
content[string(key)] = val
trie.Update(key, val)
- // Add some other data to inflate th trie
+ // Add some other data to inflate the trie
for j := byte(3); j < 13; j++ {
key, val = common.LeftPadBytes([]byte{j, i}, 32), []byte{j, i}
content[string(key)] = val
diff --git a/trie/sync_test.go b/trie/sync_test.go
index 1e27cbb67..d778555b9 100644
--- a/trie/sync_test.go
+++ b/trie/sync_test.go
@@ -42,7 +42,7 @@ func makeTestTrie() (ethdb.Database, *Trie, map[string][]byte) {
content[string(key)] = val
trie.Update(key, val)
- // Add some other data to inflate th trie
+ // Add some other data to inflate the trie
for j := byte(3); j < 13; j++ {
key, val = common.LeftPadBytes([]byte{j, i}, 32), []byte{j, i}
content[string(key)] = val
@@ -78,7 +78,7 @@ func checkTrieConsistency(db Database, root common.Hash) error {
// Create and iterate a trie rooted in a subnode
trie, err := New(root, db)
if err != nil {
- return nil // // Consider a non existent state consistent
+ return nil // Consider a non existent state consistent
}
it := trie.NodeIterator(nil)
for it.Next(true) {
@@ -310,7 +310,7 @@ func TestIncompleteTrieSync(t *testing.T) {
for _, result := range results {
added = append(added, result.Hash)
}
- // Check that all known sub-tries in the synced trie is complete
+ // Check that all known sub-tries in the synced trie are complete
for _, root := range added {
if err := checkTrieConsistency(dstDb, root); err != nil {
t.Fatalf("trie inconsistent: %v", err)
diff --git a/trie/trie.go b/trie/trie.go
index 5759f97e3..cbe496574 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -40,7 +40,7 @@ var (
)
// CacheMisses retrieves a global counter measuring the number of cache misses
-// the trie did since process startup. This isn't useful for anything apart from
+// the trie had since process startup. This isn't useful for anything apart from
// trie debugging purposes.
func CacheMisses() int64 {
return cacheMissCounter.Count()
@@ -87,14 +87,14 @@ type Trie struct {
originalRoot common.Hash
// Cache generation values.
- // cachegen increase by one with each commit operation.
+ // cachegen increases by one with each commit operation.
// new nodes are tagged with the current generation and unloaded
// when their generation is older than than cachegen-cachelimit.
cachegen, cachelimit uint16
}
// SetCacheLimit sets the number of 'cache generations' to keep.
-// A cache generations is created by a call to Commit.
+// A cache generation is created by a call to Commit.
func (t *Trie) SetCacheLimit(l uint16) {
t.cachelimit = l
}