mirror of
https://github.com/Xahau/Validation-Ledger-Tx-Store-to-xPOP.git
synced 2025-11-29 08:05:49 +00:00
Trigger xPOP generation (WIP)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { writeFile } from 'fs'
|
||||
import { dirExists } from './dirExists.mjs'
|
||||
import { ledgerIndexToFolders } from './ledgerIndexToFolders.mjs'
|
||||
import { generateV1 as xpop } from '../xpop/generateV1.mjs'
|
||||
import 'dotenv/config'
|
||||
|
||||
const lastSeenTransactions = []
|
||||
@@ -42,6 +43,16 @@ const onTransaction = async ({
|
||||
writeFile(storeDir + '/tx_' + tx.hash + '.json', Buffer.from(JSON.stringify(transaction), 'utf8'), err => {
|
||||
if (err) {
|
||||
console.log('Error writing file @ ' + storeDir)
|
||||
} else {
|
||||
/**
|
||||
* TX all ready, written to filesystem, ...
|
||||
* This is where we start a slight delay to give the `onLedger`
|
||||
* routine some time to fetch & store and then we'll try to
|
||||
* generate an xPOP.
|
||||
*/
|
||||
setTimeout(() => {
|
||||
console.log(xpop(transaction.ledger_index, tx.hash))
|
||||
}, 2000)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user