Merge branch 'master' into indexv3

This commit is contained in:
Martin Boehm 2018-07-27 13:13:40 +02:00
commit 6ce5d04ef0
2 changed files with 7 additions and 2 deletions

View File

@ -67,7 +67,7 @@ go build
## Example command
To run blockbook with fast synchronization, connection to ZeroMQ and providing https and socket.io interface, with database in local directory *data* and connected to local bitcoind with configuration specified by parameter *-blockchaincfg*:
```
./blockbook -sync -blockchaincfg=configs/bitcoin_testnet.json -internal=127.0.0.1:8333 -public=127.0.01:8334 -certfile=server/testcert -logtostderr
./blockbook -sync -blockchaincfg=configs/bitcoin_testnet.json -internal=127.0.0.1:8333 -public=127.0.0.1:8334 -certfile=server/testcert -logtostderr
```
Blockbook logs to stderr *-logtostderr* or to directory specified by parameter *-log_dir* . Verbosity of logs can be tuned by command line parameters *-v* and *-vmodule*, details at https://godoc.org/github.com/golang/glog

View File

@ -21,6 +21,7 @@ import (
// when doing huge scan, it is better to close it and reopen from time to time to free the resources
const refreshIterator = 5000000
const packedHeightBytes = 4
const dbVersion = 0
// RepairRocksDB calls RocksDb db repair function
func RepairRocksDB(name string) error {
@ -928,9 +929,13 @@ func (d *RocksDB) LoadInternalState(rpcCoin string) (*common.InternalState, erro
nc := make([]common.InternalStateColumn, len(cfNames))
for i := 0; i < len(nc); i++ {
nc[i].Name = cfNames[i]
nc[i].Version = dbVersion
for j := 0; j < len(sc); j++ {
if sc[j].Name == nc[i].Name {
nc[i].Version = sc[j].Version
// check the version of the column, if it does not match, the db is not compatible
if sc[j].Version != dbVersion {
return nil, errors.Errorf("DB version %v of column '%v' does not match the required version %v. DB is not compatible.", sc[j].Version, sc[j].Name, dbVersion)
}
nc[i].Rows = sc[j].Rows
nc[i].KeyBytes = sc[j].KeyBytes
nc[i].ValueBytes = sc[j].ValueBytes