fix txcounts loading
This commit is contained in:
parent
7d492948ce
commit
c66d07e8cc
2 changed files with 9 additions and 26 deletions
17
db/db.go
17
db/db.go
|
@ -779,7 +779,7 @@ func InitTxCounts(db *ReadOnlyDBColumnFamily) error {
|
|||
db.TxCounts = db_stack.NewSliceBackedStack(1200000)
|
||||
|
||||
options := NewIterateOptions().WithPrefix([]byte{prefixes.TxCount}).WithCfHandle(handle)
|
||||
options = options.WithIncludeKey(false).WithIncludeValue(true)
|
||||
options = options.WithIncludeKey(false).WithIncludeValue(true).WithIncludeStop(true)
|
||||
|
||||
ch := IterCF(db.DB, options)
|
||||
|
||||
|
@ -791,13 +791,14 @@ func InitTxCounts(db *ReadOnlyDBColumnFamily) error {
|
|||
log.Println("len(db.TxCounts), cap(db.TxCounts):", db.TxCounts.Len(), db.TxCounts.Cap())
|
||||
log.Println("Time to get txCounts:", duration)
|
||||
|
||||
// This needs to be len-1 because we start loading with the zero block
|
||||
// and the txcounts start at one.
|
||||
if db.TxCounts.Len() > 0 {
|
||||
db.Height = db.TxCounts.Len() - 1
|
||||
} else {
|
||||
log.Println("db.TxCounts.Len() == 0 ???")
|
||||
}
|
||||
// whjy not needs to be len-1 because we start loading with the zero block
|
||||
// and the txcounts start at one???
|
||||
db.Height = db.TxCounts.Len()
|
||||
// if db.TxCounts.Len() > 0 {
|
||||
// db.Height = db.TxCounts.Len() - 1
|
||||
// } else {
|
||||
// log.Println("db.TxCounts.Len() == 0 ???")
|
||||
// }
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -100,24 +100,6 @@ type PrefixRowKV struct {
|
|||
Value interface{}
|
||||
}
|
||||
|
||||
/*
|
||||
class DBState(typing.NamedTuple):
|
||||
genesis: bytes
|
||||
height: int
|
||||
tx_count: int
|
||||
tip: bytes
|
||||
utxo_flush_count: int
|
||||
wall_time: int
|
||||
first_sync: bool
|
||||
db_version: int
|
||||
hist_flush_count: int
|
||||
comp_flush_count: int
|
||||
comp_cursor: int
|
||||
es_sync_height: int
|
||||
|
||||
|
||||
*/
|
||||
|
||||
type DBStateKey struct {
|
||||
Prefix []byte `json:"prefix"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue