txq
Version:
TXQ: Bitcoin Transaction Storage Queue Service
29 lines (25 loc) • 713 B
text/typescript
import { Service, Inject } from 'typedi';
import { UseCase } from '../UseCase';
import { UseCaseOutcome } from '../UseCaseOutcome';
('enqInitialTxsForSync')
export default class EnqInitialTxsForSync extends UseCase {
constructor(
('txsyncService') private txsyncService,
('queueService') private queueService,
('logger') private logger) {
super();
}
public async run(): Promise<UseCaseOutcome> {
let txs = await this.txsyncService.getTxsForSync();
this.logger.info('sync_txs', {
count: txs.length
});
for (const tx of txs) {
this.queueService.enqTxStatus(tx);
}
return {
success: true,
result: txs
};
}
}