This commit is contained in:
aozhiwei 2023-07-13 14:10:02 +08:00
parent cd713ad5fe
commit 5b30a8880d

View File

@ -9,7 +9,6 @@ const BaseService = require('./baseservice');
class PullBcEvent extends BaseService {
async init(bc, net, event) {
this.conn = await dbpool.getBcEventConn(app);
this.lastBlockNumber = 0;
this.bc = bc;
this.net = net;
@ -87,7 +86,7 @@ class PullBcEvent extends BaseService {
const firstBlockNumber = this.getInitBlock();
while (this.lastBlockNumber < 1) {
try {
const {err, row} = await this.conn.ormSelectOne(
const {err, row} = await dbpool.getBcEventConn(app).ormSelectOne(
't_last_block',
[
['net_id', this.getNetId()],
@ -133,7 +132,7 @@ class PullBcEvent extends BaseService {
async saveLastBlockNumber(blockNumber) {
const logHead = this.genLogHead(' event_process.saveLastBlockNumber: ');
while (true) {
const {err} = await this.conn.upsert(
const {err} = await dbpool.getBcEventConn(app).upsert(
't_last_block',
[
['net_id', this.getNetId()],
@ -169,7 +168,7 @@ class PullBcEvent extends BaseService {
const nowTime = utils.getUtcTime();
const returnValues = event['returnValues'];
const hashCode = '';
const {err} = await this.conn.upsert(
const {err} = await dbpool.getBcEventConn(app).upsert(
't_blockchain_event',
[
['txhash', event['transactionHash']],