Skip to content

Commit 7f9d23d

Browse files
committed
code style
1 parent 9ba7bf4 commit 7f9d23d

5 files changed

Lines changed: 15 additions & 13 deletions

File tree

blockchain/blockchain.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,9 @@ func (b *Blockchain) HeadState() (core.StateReader, StateCloser, error) {
553553

554554
// StateAtBlockNumber returns a StateReader that provides
555555
// a stable view to the state at the given block number
556-
func (b *Blockchain) StateAtBlockNumber(blockNumber uint64) (core.StateReader, StateCloser, error) {
556+
func (b *Blockchain) StateAtBlockNumber(
557+
blockNumber uint64,
558+
) (core.StateReader, StateCloser, error) {
557559
b.listener.OnRead("StateAtBlockNumber")
558560
txn := b.database.NewIndexedBatch()
559561

@@ -567,7 +569,9 @@ func (b *Blockchain) StateAtBlockNumber(blockNumber uint64) (core.StateReader, S
567569

568570
// StateAtBlockHash returns a StateReader that provides
569571
// a stable view to the state at the given block hash
570-
func (b *Blockchain) StateAtBlockHash(blockHash *felt.Felt) (core.StateReader, StateCloser, error) {
572+
func (b *Blockchain) StateAtBlockHash(
573+
blockHash *felt.Felt,
574+
) (core.StateReader, StateCloser, error) {
571575
b.listener.OnRead("StateAtBlockHash")
572576
if blockHash.IsZero() {
573577
memDB := memory.New()

core/trie2/triedb/database.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
type Config struct {
2020
PathConfig *pathdb.Config
2121
HashConfig *hashdb.Config
22+
RawConfig *rawdb.Config
2223
}
2324

2425
func New(disk db.KeyValueStore, config *Config) (database.TrieDB, error) {
@@ -29,6 +30,8 @@ func New(disk db.KeyValueStore, config *Config) (database.TrieDB, error) {
2930
return pathdb.New(disk, config.PathConfig)
3031
} else if config.HashConfig != nil {
3132
return hashdb.New(disk, config.HashConfig), nil
33+
} else if config.RawConfig != nil {
34+
return rawdb.New(disk), nil
3235
}
3336
return nil, fmt.Errorf("invalid config")
3437
}

core/trie2/triedb/rawdb/database.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313

1414
var _ database.TrieDB = (*Database)(nil)
1515

16+
type Config struct{}
17+
1618
type Database struct {
1719
disk db.KeyValueStore
1820

@@ -115,24 +117,16 @@ func (d *Database) updateNode(
115117
}
116118

117119
if _, deleted := n.(*trienode.DeletedNode); deleted {
118-
err := trieutils.DeleteNodeByPath(batch, bucket, owner, path, n.IsLeaf())
119-
if err != nil {
120-
return err
121-
}
122-
return nil
120+
return trieutils.DeleteNodeByPath(batch, bucket, owner, path, n.IsLeaf())
123121
}
124-
err := trieutils.WriteNodeByPath(
122+
return trieutils.WriteNodeByPath(
125123
batch,
126124
bucket,
127125
owner,
128126
path,
129127
n.IsLeaf(),
130128
n.Blob(),
131129
)
132-
if err != nil {
133-
return err
134-
}
135-
return nil
136130
}
137131

138132
// This method was added to satisfy the TrieDB interface, but it is not used.

db/pebble/db.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func New(path string, options ...Option) (db.KeyValueStore, error) {
3737
}
3838

3939
pDB, err := pebble.Open(path, &opts)
40-
4140
if err != nil {
4241
return nil, err
4342
}

rpc/v8/transaction.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,11 @@ func (h *Handler) AddTransaction(ctx context.Context, tx *BroadcastedTransaction
633633
} else {
634634
res, err = h.pushToFeederGateway(ctx, tx)
635635
}
636+
636637
if err != nil {
637638
return AddTxResponse{}, err
638639
}
640+
639641
if h.submittedTransactionsCache != nil {
640642
h.submittedTransactionsCache.Add(res.TransactionHash)
641643
}

0 commit comments

Comments
 (0)