1
This commit is contained in:
parent
ee0e02c304
commit
1c485745e5
@ -41,8 +41,8 @@ class BlockChain {
|
|||||||
event.emitEvent(C.BC_INITIALIZED_EVENT);
|
event.emitEvent(C.BC_INITIALIZED_EVENT);
|
||||||
{
|
{
|
||||||
await this.mustBeActive();
|
await this.mustBeActive();
|
||||||
const netId = await this.getNetId();
|
this.netId = await this.asyncGetNetId();
|
||||||
console.log('net_id:', netId, ' blockNumber:', this.getCurrBlockNumber(),
|
console.log('net_id:', this.getNetId(), ' blockNumber:', this.getCurrBlockNumber(),
|
||||||
' handleRevert:', this.web3.eth.handleRevert, ' isOnlineEnv:', utils.isOnlineEnv());
|
' handleRevert:', this.web3.eth.handleRevert, ' isOnlineEnv:', utils.isOnlineEnv());
|
||||||
}
|
}
|
||||||
/*let banlances = await this['shardInstance'].methods.balanceOfBatch
|
/*let banlances = await this['shardInstance'].methods.balanceOfBatch
|
||||||
@ -58,10 +58,14 @@ class BlockChain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNetId() {
|
async asyncGetNetId() {
|
||||||
return await this.web3.eth.getChainId();
|
return await this.web3.eth.getChainId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getNetId() {
|
||||||
|
return '' + this.netId;
|
||||||
|
}
|
||||||
|
|
||||||
async refreshBlockNumber() {
|
async refreshBlockNumber() {
|
||||||
const logClass = 'refreshBlockNumber';
|
const logClass = 'refreshBlockNumber';
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -100,7 +104,7 @@ class BlockChain {
|
|||||||
const {err, row} = await conn.ormSelectOne(
|
const {err, row} = await conn.ormSelectOne(
|
||||||
't_parameter',
|
't_parameter',
|
||||||
[
|
[
|
||||||
['name', 'first_block_number.' + await this.getNetId() + '.']
|
['name', 'first_block_number.' + this.getNetId() + '.']
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
if (!err && row) {
|
if (!err && row) {
|
||||||
|
@ -6,11 +6,13 @@ const BaseService = require('./baseservice');
|
|||||||
|
|
||||||
class EventProcess extends BaseService {
|
class EventProcess extends BaseService {
|
||||||
|
|
||||||
async init(conn, instance, cb) {
|
async init(bc, conn, instance, cb) {
|
||||||
this.conn = conn;
|
this.conn = conn;
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
this.cb = cb;
|
this.cb = cb;
|
||||||
this.lastBlockNumber = 0;
|
this.lastBlockNumber = 0;
|
||||||
|
this.bc = bc;
|
||||||
|
this.netId = await this.bc.getNetId();
|
||||||
await this.start();
|
await this.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user