Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #150 from irisnet/develop
Browse files Browse the repository at this point in the history
R4R: merge develop to master for release v0.13.3
  • Loading branch information
xiaoxm1026 authored May 29, 2019
2 parents 420a287 + f4f7e08 commit f293340
Show file tree
Hide file tree
Showing 52 changed files with 356 additions and 2,065 deletions.
38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/custom.md

This file was deleted.

79 changes: 11 additions & 68 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@
version = "v2.0.0"
name = "github.com/jolestar/go-commons-pool"

[[constraint]]
version = "v1.2.2"
name = "github.com/hashicorp/consul"

[[constraint]]
version = "^v1.9.1"
name = "go.uber.org/zap"
Expand Down
3 changes: 2 additions & 1 deletion conf/db/types.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package db

import (
"os"

"github.com/irisnet/irishub-sync/logger"
"github.com/irisnet/irishub-sync/util/constant"
"os"
)

var (
Expand Down
46 changes: 6 additions & 40 deletions conf/server/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,17 @@ import (
)

var (
BlockChainMonitorUrl = []string{"tcp://192.168.150.7:30657"}
ChainId = "rainbow-dev"
BlockChainMonitorUrl = []string{"tcp://35.201.147.145:30657"}
ChainId = "fuxi"

WorkerNumCreateTask = 2
WorkerNumExecuteTask = 60

InitConnectionNum = 50 // fast init num of tendermint client pool
MaxConnectionNum = 100 // max size of tendermint client pool
CronWatchBlock = "*/1 * * * * *" // every 1 seconds
CronCalculateUpTime = "0 */1 * * * *" // every minute
CronCalculateTxGas = "0 */5 * * * *" // every five minute
SyncProposalStatus = "0 */1 * * * *" // every minute
CronSaveValidatorHistory = "@daily" // every day
CronUpdateDelegator = "0/5 * * * * *" // every ten minute
InitConnectionNum = 50 // fast init num of tendermint client pool
MaxConnectionNum = 100 // max size of tendermint client pool
SyncProposalStatus = "0 */1 * * * *" // every minute

// deprecated
SyncMaxGoroutine = 60 // max go routine in server
// deprecated
SyncBlockNumFastSync = 8000 // sync block num each goroutine

ConsulAddr = "192.168.150.7:8500"
SyncWithDLock = false
Network = "testnet"
Network = "testnet"
)

// get value of env var
Expand All @@ -50,28 +38,6 @@ func init() {
}
logger.Info("Env Value", logger.String(constant.EnvNameSerNetworkChainId, ChainId))

consulAddr, found := os.LookupEnv(constant.EnvNameConsulAddr)
if found {
ConsulAddr = consulAddr
}
logger.Info("Env Value", logger.String(constant.EnvNameConsulAddr, ConsulAddr))

withDLock, found := os.LookupEnv(constant.EnvNameSyncWithDLock)
if found {
flag, err := strconv.ParseBool(withDLock)
if err != nil {
logger.Fatal("Env Value", logger.String(constant.EnvNameSyncWithDLock, withDLock))
}
SyncWithDLock = flag
}
logger.Info("Env Value", logger.Bool(constant.EnvNameSyncWithDLock, SyncWithDLock))

cronSaveValidatorHistory, found := os.LookupEnv(constant.EnvNameCronSaveValidatorHistory)
if found {
CronSaveValidatorHistory = cronSaveValidatorHistory
}
logger.Info("Env Value", logger.String(constant.EnvNameCronSaveValidatorHistory, cronSaveValidatorHistory))

workerNumCreateTask, found := os.LookupEnv(constant.EnvNameWorkerNumCreateTask)
if found {
var err error
Expand Down
33 changes: 4 additions & 29 deletions script/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,32 @@
// )

// create collections
db.createCollection("account");
db.createCollection("token_flow");
db.createCollection("block");
db.createCollection("stake_role_candidate");
db.createCollection("stake_role_delegator");
db.createCollection("sync_task");
db.createCollection("tx_common");
db.createCollection("validator_up_time");
db.createCollection("tx_gas");
db.createCollection("proposal");
db.createCollection("tx_msg");
db.createCollection("power_change");//explorer
db.createCollection("uptime_change");
db.createCollection("sync_conf");
db.createCollection("validator_history");
db.createCollection("mgo_txn");
db.createCollection("mgo_txn.stash");
db.createCollection("ex_tx_num_stat");



// create index
db.token_flow.createIndex({"block_height": -1});
db.account.createIndex({"address": 1}, {"unique": true});
db.block.createIndex({"height": -1}, {"unique": true});

db.stake_role_candidate.createIndex({"address": 1}, {"unique": true});
db.stake_role_candidate.createIndex({"pub_key": 1});

db.stake_role_delegator.createIndex({"validator_addr": 1});
db.stake_role_delegator.createIndex({"address": 1});
db.stake_role_delegator.createIndex({"address": 1, "validator_addr": 1}, {"unique": true});

db.sync_task.createIndex({"start_height": 1, "end_height": 1}, {"unique": true});
db.sync_task.createIndex({"status": 1}, {"background": true});

db.tx_common.createIndex({"height": -1});
db.tx_common.createIndex({"time": -1});
Expand All @@ -50,11 +45,8 @@ db.tx_common.createIndex({"type": 1});
db.tx_common.createIndex({"status": 1});

db.power_change.createIndex({"height": 1, "address": 1}, {"unique": true});
db.uptime_change.createIndex({"time": 1, "address": 1}, {"unique": true});

db.validator_up_time.createIndex({"val_address": 1}, {"unique": true});

db.tx_gas.createIndex({"tx_type": 1}, {"unique": true});
db.proposal.createIndex({"proposal_id": 1}, {"unique": true});
db.tx_msg.createIndex({"hash": 1}, {"unique": true});
db.ex_tx_num_stat.createIndex({"date": -1}, {"unique": true});
Expand All @@ -68,13 +60,9 @@ db.sync_conf.insert({"block_num_per_worker_handle": 50, "max_worker_sleep_time":
// db.power_change.drop();
// db.proposal.drop();
// db.stake_role_candidate.drop();
// db.stake_role_delegator.drop();
// db.sync_task.drop();
// db.tx_common.drop();
// db.validator_up_time.drop();
// db.tx_gas.drop();
// db.tx_msg.drop();
// db.uptime_change.drop();
// db.mgo_txn.drop();
// db.mgo_txn.stash.drop();

Expand All @@ -84,22 +72,9 @@ db.sync_conf.insert({"block_num_per_worker_handle": 50, "max_worker_sleep_time":
// db.power_change.remove({});
// db.proposal.remove({});
// db.stake_role_candidate.remove({});
// db.stake_role_delegator.remove({});
// db.sync_task.remove({});
// db.tx_common.remove({});
// db.validator_up_time.remove({});
// db.tx_gas.remove({});
// db.tx_msg.remove({});
// db.uptime_change.remove({});
// db.mgo_txn.remove({});
// db.mgo_txn.stash.remove({});










Loading

0 comments on commit f293340

Please sign in to comment.