1
This commit is contained in:
parent
a4927c82b6
commit
d3deeb5c99
@ -33,7 +33,6 @@ class BlockChain {
|
||||
|
||||
async init() {
|
||||
this.web3Conf = metaFactory.getWeb3Conf(this.netId);
|
||||
console.log(this.web3Conf);
|
||||
this.contractsConf = metaFactory.getContractsConf(this.netId);
|
||||
this.netDir = metaFactory.getNetDir(this.netId);
|
||||
|
||||
@ -95,6 +94,10 @@ class BlockChain {
|
||||
return contract;
|
||||
}
|
||||
|
||||
getCurrBlockNumber() {
|
||||
return this.currBlockNumber;
|
||||
}
|
||||
|
||||
async lockQuery() {
|
||||
while (this.queryLockTimes > 3) {
|
||||
await utils.sleep(100 + utils.randRange(10, 100));
|
||||
|
@ -117,6 +117,8 @@ async function init() {
|
||||
const netId = net['net_id'];
|
||||
const netDir = configDir + 'nets/' + netId + '/';
|
||||
web3ConfHash[netId] = {
|
||||
'net_id': netId,
|
||||
'netId': netId,
|
||||
'Web3': utils.readJsonFromFile(netDir + 'web3.json'),
|
||||
'Contract': utils.readJsonFromFile(netDir + 'contract.json'),
|
||||
'Events': net['events'],
|
||||
|
@ -19,13 +19,13 @@ class BlockChain extends BaseService {
|
||||
|
||||
static async staticInit() {
|
||||
metaFactory.getNetList().forEach(async (net) => {
|
||||
const bc = new bcClass(net['net_id']);
|
||||
netIdHash[net['net_id']] = bc;
|
||||
const bc = new bcClass(net['netId']);
|
||||
netIdHash[net['netId']] = bc;
|
||||
await bc.init();
|
||||
});
|
||||
}
|
||||
|
||||
async init(netId) {
|
||||
init(netId) {
|
||||
this.#bc = getBc(netId);
|
||||
return this.#bc != null;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class PullBcEvent extends BaseService {
|
||||
}
|
||||
continue;
|
||||
} catch (err) {
|
||||
log.log(err);
|
||||
log.error(err);
|
||||
}
|
||||
await utils.sleep(5000 + utils.randRange(500, 1500));
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ class BcSpider extends BaseTask {
|
||||
|
||||
createPullBcEventService(net, event) {
|
||||
const bc = serviceFactory.create('BlockChain');
|
||||
bc.init(net['net_id']);
|
||||
const pullBcEventService = serviceFactory.create('PullBcEvent');
|
||||
event['pullBcEventService'] = pullBcEventService;
|
||||
pullBcEventService.init(bc, net, event);
|
||||
|
Loading…
x
Reference in New Issue
Block a user