Skip to content

Commit 0eac601

Browse files
committed
Merge pull request #1779 from karalabe/split-block-storage-3000
core: split the db blocks into components, move TD out top level
2 parents 4e075e4 + cdc2662 commit 0eac601

File tree

18 files changed

+881
-381
lines changed

18 files changed

+881
-381
lines changed

cmd/geth/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,17 +528,16 @@ func blockRecovery(ctx *cli.Context) {
528528

529529
var block *types.Block
530530
if arg[0] == '#' {
531-
block = core.GetBlockByNumber(blockDb, common.String2Big(arg[1:]).Uint64())
531+
block = core.GetBlock(blockDb, core.GetCanonicalHash(blockDb, common.String2Big(arg[1:]).Uint64()))
532532
} else {
533-
block = core.GetBlockByHash(blockDb, common.HexToHash(arg))
533+
block = core.GetBlock(blockDb, common.HexToHash(arg))
534534
}
535535

536536
if block == nil {
537537
glog.Fatalln("block not found. Recovery failed")
538538
}
539539

540-
err = core.WriteHead(blockDb, block)
541-
if err != nil {
540+
if err = core.WriteHeadBlockHash(blockDb, block.Hash()); err != nil {
542541
glog.Fatalln("block write err", err)
543542
}
544543
glog.Infof("Recovery succesful. New HEAD %x\n", block.Hash())

core/chain_makers.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ func GenerateChain(parent *types.Block, db common.Database, n int, gen func(int,
158158
for i := 0; i < n; i++ {
159159
header := makeHeader(parent, statedb)
160160
block := genblock(i, header)
161-
block.Td = CalcTD(block, parent)
162161
blocks[i] = block
163162
parent = block
164163
}

0 commit comments

Comments
 (0)