mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
trie/bintrie: gofmt
Fix goimports alignment in struct literals, const block, and var block so the CI Lint job passes.
This commit is contained in:
parent
957f85fa58
commit
16b0f9d2d9
4 changed files with 21 additions and 21 deletions
|
|
@ -29,8 +29,8 @@ func makeTrie(t *testing.T, entries [][2]common.Hash) *BinaryTrie {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
store := NewNodeStore()
|
store := NewNodeStore()
|
||||||
tr := &BinaryTrie{
|
tr := &BinaryTrie{
|
||||||
store: store,
|
store: store,
|
||||||
tracer: trie.NewPrevalueTracer(),
|
tracer: trie.NewPrevalueTracer(),
|
||||||
}
|
}
|
||||||
for _, kv := range entries {
|
for _, kv := range entries {
|
||||||
if err := store.Insert(kv[0][:], kv[1][:], nil); err != nil {
|
if err := store.Insert(kv[0][:], kv[1][:], nil); err != nil {
|
||||||
|
|
@ -63,8 +63,8 @@ func countLeaves(t *testing.T, tr *BinaryTrie) int {
|
||||||
// no nodes and reports no error.
|
// no nodes and reports no error.
|
||||||
func TestIteratorEmptyTrie(t *testing.T) {
|
func TestIteratorEmptyTrie(t *testing.T) {
|
||||||
tr := &BinaryTrie{
|
tr := &BinaryTrie{
|
||||||
store: NewNodeStore(),
|
store: NewNodeStore(),
|
||||||
tracer: trie.NewPrevalueTracer(),
|
tracer: trie.NewPrevalueTracer(),
|
||||||
}
|
}
|
||||||
it, err := newBinaryNodeIterator(tr, nil)
|
it, err := newBinaryNodeIterator(tr, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ package bintrie
|
||||||
type NodeKind uint8
|
type NodeKind uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
KindEmpty NodeKind = iota
|
KindEmpty NodeKind = iota
|
||||||
KindInternal
|
KindInternal
|
||||||
KindStem // up to 256 values per stem
|
KindStem // up to 256 values per stem
|
||||||
KindHashed
|
KindHashed
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,9 +174,9 @@ func (t *BinaryTrie) GetWithHashedKey(key []byte) ([]byte, error) {
|
||||||
// GetAccount returns the account information for the given address.
|
// GetAccount returns the account information for the given address.
|
||||||
func (t *BinaryTrie) GetAccount(addr common.Address) (*types.StateAccount, error) {
|
func (t *BinaryTrie) GetAccount(addr common.Address) (*types.StateAccount, error) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
acc = &types.StateAccount{}
|
acc = &types.StateAccount{}
|
||||||
key = GetBinaryTreeKey(addr, zero[:])
|
key = GetBinaryTreeKey(addr, zero[:])
|
||||||
)
|
)
|
||||||
|
|
||||||
values, err := t.store.GetValuesAtStem(key[:StemSize], t.nodeResolver)
|
values, err := t.store.GetValuesAtStem(key[:StemSize], t.nodeResolver)
|
||||||
|
|
|
||||||
|
|
@ -188,8 +188,8 @@ func TestMerkleizeMultipleEntries(t *testing.T) {
|
||||||
func TestStorageRoundTrip(t *testing.T) {
|
func TestStorageRoundTrip(t *testing.T) {
|
||||||
tracer := trie.NewPrevalueTracer()
|
tracer := trie.NewPrevalueTracer()
|
||||||
tr := &BinaryTrie{
|
tr := &BinaryTrie{
|
||||||
store: NewNodeStore(),
|
store: NewNodeStore(),
|
||||||
tracer: tracer,
|
tracer: tracer,
|
||||||
}
|
}
|
||||||
addr := common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678")
|
addr := common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678")
|
||||||
|
|
||||||
|
|
@ -256,8 +256,8 @@ func TestStorageRoundTrip(t *testing.T) {
|
||||||
func newEmptyTestTrie(t *testing.T) *BinaryTrie {
|
func newEmptyTestTrie(t *testing.T) *BinaryTrie {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
return &BinaryTrie{
|
return &BinaryTrie{
|
||||||
store: NewNodeStore(),
|
store: NewNodeStore(),
|
||||||
tracer: trie.NewPrevalueTracer(),
|
tracer: trie.NewPrevalueTracer(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -581,8 +581,8 @@ func TestBinaryTrieWitness(t *testing.T) {
|
||||||
tracer := trie.NewPrevalueTracer()
|
tracer := trie.NewPrevalueTracer()
|
||||||
|
|
||||||
tr := &BinaryTrie{
|
tr := &BinaryTrie{
|
||||||
store: NewNodeStore(),
|
store: NewNodeStore(),
|
||||||
tracer: tracer,
|
tracer: tracer,
|
||||||
}
|
}
|
||||||
if w := tr.Witness(); len(w) != 0 {
|
if w := tr.Witness(); len(w) != 0 {
|
||||||
t.Fatal("expected empty witness for fresh trie")
|
t.Fatal("expected empty witness for fresh trie")
|
||||||
|
|
@ -608,8 +608,8 @@ func TestBinaryTrieWitness(t *testing.T) {
|
||||||
func testAccount(t *testing.T, addr common.Address, nonce uint64, balance uint64) *BinaryTrie {
|
func testAccount(t *testing.T, addr common.Address, nonce uint64, balance uint64) *BinaryTrie {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
tr := &BinaryTrie{
|
tr := &BinaryTrie{
|
||||||
store: NewNodeStore(),
|
store: NewNodeStore(),
|
||||||
tracer: trie.NewPrevalueTracer(),
|
tracer: trie.NewPrevalueTracer(),
|
||||||
}
|
}
|
||||||
acc := &types.StateAccount{
|
acc := &types.StateAccount{
|
||||||
Nonce: nonce,
|
Nonce: nonce,
|
||||||
|
|
@ -662,8 +662,8 @@ func TestGetAccountNonMembershipStemRoot(t *testing.T) {
|
||||||
// address returns nil when the trie root is an InternalNode (multi-account trie).
|
// address returns nil when the trie root is an InternalNode (multi-account trie).
|
||||||
func TestGetAccountNonMembershipInternalRoot(t *testing.T) {
|
func TestGetAccountNonMembershipInternalRoot(t *testing.T) {
|
||||||
tr := &BinaryTrie{
|
tr := &BinaryTrie{
|
||||||
store: NewNodeStore(),
|
store: NewNodeStore(),
|
||||||
tracer: trie.NewPrevalueTracer(),
|
tracer: trie.NewPrevalueTracer(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert two accounts whose binary tree keys have different first bits
|
// Insert two accounts whose binary tree keys have different first bits
|
||||||
|
|
@ -725,8 +725,8 @@ func TestGetStorageNonMembershipStemRoot(t *testing.T) {
|
||||||
// non-existent address returns nil when the root is an InternalNode.
|
// non-existent address returns nil when the root is an InternalNode.
|
||||||
func TestGetStorageNonMembershipInternalRoot(t *testing.T) {
|
func TestGetStorageNonMembershipInternalRoot(t *testing.T) {
|
||||||
tr := &BinaryTrie{
|
tr := &BinaryTrie{
|
||||||
store: NewNodeStore(),
|
store: NewNodeStore(),
|
||||||
tracer: trie.NewPrevalueTracer(),
|
tracer: trie.NewPrevalueTracer(),
|
||||||
}
|
}
|
||||||
|
|
||||||
addr := common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678")
|
addr := common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue