Skip to content

Commit 394ae82

Browse files
committed
Tidy up
1 parent 9f52597 commit 394ae82

File tree

7 files changed

+10
-39
lines changed

7 files changed

+10
-39
lines changed

core/blockchain.go

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,9 +2589,6 @@ func (bc *BlockChain) SetTail(height uint64) error {
25892589
return err
25902590
}
25912591

2592-
// TODO delete relevant state
2593-
// bc.triedb.TruncateTail(num)
2594-
25952592
// Clear out any stale content from the caches
25962593
bc.bodyCache.Purge()
25972594
bc.bodyRLPCache.Purge()
@@ -2617,7 +2614,7 @@ func (bc *BlockChain) SetShardStartHeight(height uint64) error {
26172614
return err
26182615
}
26192616

2620-
// TODO perisisting this should happen with batch in SetTail
2617+
// TODO(stwiname) perisisting this should happen with batch in SetTail
26212618
config.DesiredChainDataStart = &height
26222619
rawdb.WriteChainDataConfig(bc.db, config)
26232620

@@ -2636,24 +2633,6 @@ func (bc *BlockChain) SetShardEndHeight(height *uint64) error {
26362633
if err := bc.SetHead(*height); err != nil {
26372634
return err
26382635
}
2639-
2640-
// TODO truncate state
2641-
2642-
2643-
// type freezer interface {
2644-
// Freeze(threshold uint64) error
2645-
// }
2646-
// err = api.eth.chainDb.(freezer).Freeze(0)
2647-
// if err != nil {
2648-
// return false, err
2649-
// }
2650-
// TODO truncate state head
2651-
// err = api.eth.blockchain.TrieDB().SetHead(*height)
2652-
// if err != nil {
2653-
// return false, err
2654-
// }
2655-
2656-
// TODO call blockchain.Stop()?
26572636
}
26582637
// else blockchain.go will limit this once the desired height is reached
26592638

core/blockchain_reader.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ func (bc *BlockChain) SubscribeBlockProcessingEvent(ch chan<- bool) event.Subscr
442442
return bc.scope.Track(bc.blockProcFeed.Subscribe(ch))
443443
}
444444

445-
446445
// GetTxBloom retrieves the Transactions Bloom for the given block
447446
// TODO this is a temporary function for development so there is no caching
448447
func (bc *BlockChain) GetTxBloom(hash common.Hash) *[]byte {

core/headerchain.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,9 @@ func NewHeaderChain(chainDb ethdb.Database, config *params.ChainConfig, engine c
109109
hc.earliestHeaderHash = shead.Hash()
110110
}
111111
if dataConfig.DesiredChainDataEnd != nil {
112-
// TODO this could be in the futrue and should throw
113112
if chead := hc.GetHeaderByNumber(*dataConfig.DesiredChainDataEnd); chead != nil {
114113
hc.currentHeader.Store(chead)
115114
hc.currentHeaderHash = chead.Hash()
116-
} else {
117-
// TODO should this throw?
118-
return nil, fmt.Errorf("Failed to get header for current height %d", *dataConfig.DesiredChainDataEnd)
119115
}
120116
}
121117
}
@@ -683,7 +679,6 @@ func (hc *HeaderChain) SetTail(tail uint64, delFn DeleteBlockContentCallback) er
683679

684680
batch := hc.chainDb.NewBatch()
685681

686-
// TODO handle any pending ancients data
687682
frozen, err := hc.chainDb.Ancients()
688683
if err != nil {
689684
return err

core/transaction_bloom_indexer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ type TransactionBloomIndexer struct {
2121
gen *bloombits.Generator // generator to rotate the bloom bits crating the bloom index
2222
section uint64 // Section is the section number being processed currently
2323
head common.Hash // Head is the hash of the last header processed
24-
config *params.ChainConfig
24+
config *params.ChainConfig
2525
}
2626

2727
// NewTransactionBloomIndexer returns a chain indexer that generates bloom bits data for the
2828
// canonical chain for transactions filtering.
2929
func NewTransactionBloomIndexer(db ethdb.Database, chainConfig *params.ChainConfig, size, confirms uint64) *ChainIndexer {
3030
backend := &TransactionBloomIndexer{
31-
db: db,
32-
size: size,
31+
db: db,
32+
size: size,
3333
config: chainConfig,
3434
}
3535
table := rawdb.NewTable(db, string(rawdb.BloomBitsTransactionIndexPrefix))
@@ -51,7 +51,7 @@ func (b *TransactionBloomIndexer) Process(ctx context.Context, header *types.Hea
5151
// Get the bloom value from the db
5252
bloom, err := b.getOrCreateTxBloom(header)
5353
if err != nil {
54-
return err;
54+
return err
5555
}
5656
// Add the bloom value to the bloombits
5757
b.gen.AddBloom(uint(header.Number.Uint64()-b.section*b.size), *bloom)
@@ -79,7 +79,7 @@ func (b *TransactionBloomIndexer) Prune(threshold uint64) error {
7979
}
8080

8181
// getOrCreateTxBloom fetches the transactions bloom for the block, if it doesn't exist it will create the transaction bloom and save it
82-
func (b* TransactionBloomIndexer) getOrCreateTxBloom(header *types.Header) (*types.Bloom, error) {
82+
func (b *TransactionBloomIndexer) getOrCreateTxBloom(header *types.Header) (*types.Bloom, error) {
8383
bloom := rawdb.ReadTxBloom(b.db, header.Hash(), header.Number.Uint64())
8484

8585
if bloom == nil {

eth/api_admin.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (api *AdminAPI) SetEndHeight(height *uint64) (bool, error) {
158158
// TODO can this be moved?
159159
api.eth.Downloader().SetEndHeight(height)
160160

161-
return true, nil;
161+
return true, nil
162162
}
163163

164164
func (api *AdminAPI) SetStartHeight(height *uint64) (bool, error) {
@@ -224,7 +224,7 @@ func (api *AdminAPI) StateStartHeight() (*uint64, error) {
224224
_, err := api.eth.blockchain.StateAt(block.Root())
225225
if err == nil {
226226
startBlock = mid
227-
if (mid == 0) {
227+
if mid == 0 {
228228
break
229229
}
230230
high = mid - 1 // Look for an earlier block

eth/api_backend.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ func (b *EthAPIBackend) StateAtTransaction(ctx context.Context, block *types.Blo
441441
return b.eth.stateAtTransaction(ctx, block, txIndex, reexec)
442442
}
443443

444-
445444
func (b *EthAPIBackend) GetTxBloom(ctx context.Context, hash common.Hash) types.Bloom {
446445
raw := b.eth.blockchain.GetTxBloom(hash)
447446
return types.BytesToBloom(*raw)

params/data_params.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package params
22

33
type ChainDataConfig struct {
4-
DesiredChainDataStart *uint64 `json:"desiredChainDataStart"`
5-
DesiredChainDataEnd *uint64 `json:"desiredChainDataEnd"`
6-
DesiredChainStateStart *uint64 `json:"desiredChainStateStart"`
4+
DesiredChainDataStart *uint64 `json:"desiredChainDataStart"`
5+
DesiredChainDataEnd *uint64 `json:"desiredChainDataEnd"`
76
}
87

98
type ChainDataStatus struct {

0 commit comments

Comments
 (0)