1
This commit is contained in:
parent
cd713ad5fe
commit
5b30a8880d
@ -9,7 +9,6 @@ const BaseService = require('./baseservice');
|
|||||||
class PullBcEvent extends BaseService {
|
class PullBcEvent extends BaseService {
|
||||||
|
|
||||||
async init(bc, net, event) {
|
async init(bc, net, event) {
|
||||||
this.conn = await dbpool.getBcEventConn(app);
|
|
||||||
this.lastBlockNumber = 0;
|
this.lastBlockNumber = 0;
|
||||||
this.bc = bc;
|
this.bc = bc;
|
||||||
this.net = net;
|
this.net = net;
|
||||||
@ -87,7 +86,7 @@ class PullBcEvent extends BaseService {
|
|||||||
const firstBlockNumber = this.getInitBlock();
|
const firstBlockNumber = this.getInitBlock();
|
||||||
while (this.lastBlockNumber < 1) {
|
while (this.lastBlockNumber < 1) {
|
||||||
try {
|
try {
|
||||||
const {err, row} = await this.conn.ormSelectOne(
|
const {err, row} = await dbpool.getBcEventConn(app).ormSelectOne(
|
||||||
't_last_block',
|
't_last_block',
|
||||||
[
|
[
|
||||||
['net_id', this.getNetId()],
|
['net_id', this.getNetId()],
|
||||||
@ -133,7 +132,7 @@ class PullBcEvent extends BaseService {
|
|||||||
async saveLastBlockNumber(blockNumber) {
|
async saveLastBlockNumber(blockNumber) {
|
||||||
const logHead = this.genLogHead(' event_process.saveLastBlockNumber: ');
|
const logHead = this.genLogHead(' event_process.saveLastBlockNumber: ');
|
||||||
while (true) {
|
while (true) {
|
||||||
const {err} = await this.conn.upsert(
|
const {err} = await dbpool.getBcEventConn(app).upsert(
|
||||||
't_last_block',
|
't_last_block',
|
||||||
[
|
[
|
||||||
['net_id', this.getNetId()],
|
['net_id', this.getNetId()],
|
||||||
@ -169,7 +168,7 @@ class PullBcEvent extends BaseService {
|
|||||||
const nowTime = utils.getUtcTime();
|
const nowTime = utils.getUtcTime();
|
||||||
const returnValues = event['returnValues'];
|
const returnValues = event['returnValues'];
|
||||||
const hashCode = '';
|
const hashCode = '';
|
||||||
const {err} = await this.conn.upsert(
|
const {err} = await dbpool.getBcEventConn(app).upsert(
|
||||||
't_blockchain_event',
|
't_blockchain_event',
|
||||||
[
|
[
|
||||||
['txhash', event['transactionHash']],
|
['txhash', event['transactionHash']],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user