func main() { flag.Parse() from, to := mustDecodeHash(*start), mustDecodeHash(*end) runtime.GOMAXPROCS(*cpu) go func() { glog.Infoln(http.ListenAndServe("localhost:6060", nil)) }() var err error if *mem { db, err = memdb.NewMemoryDB([]string{*path}) } else { db, err = rocksdb.NewRocksDB(*path, *cacheSize) } checkErr(err) defer db.Close() go report() cmd, ok := commands[*command] if !ok { glog.Errorln("Unknown command:", *command) os.Exit(1) } var queue ledger.Queue for { state, err := ledger.NewLedgerStateFromDB(*from, db) checkErr(err) queue.Add(state) checkErr(queue.Do(cmd())) if *from == *to { if *command != "diff" || *to == *unfortunateGenesis { queue.AddEmpty() checkErr(queue.Do(cmd())) } return } *from = state.PreviousLedger } }
func (s *DiffSuite) SetUpSuite(c *C) { var err error s.db, err = memdb.NewMemoryDB([]string{"testdata/38129-32570.gz", "testdata/99943.gz"}) c.Assert(err, IsNil) }