diff --git a/package.json b/package.json index dc01df5..2d47c14 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,10 @@ "private": true, "main": "dist/collector.js", "scripts": { - "collector": "node dist/collector.js", - "server": "node dist/server.js", + "collector": "npm run prepare && node dist/collector.js", + "server": "npm run prepare && node dist/server.js", "server:watch": "nodemon", - "log_server": "node dist/log_server.js", - "data_patcher": "node dist/data_patcher.js", + "log_server": "npm run prepare && node dist/log_server.js", "lint": "eslint './src/**/*.ts'", "lint-windows": "eslint ./src/**/*.ts", "test": "echo \"Error: no test specified\" && exit 1", @@ -17,7 +16,7 @@ "compile": "tsc -p .", "fix": "gts fix", "prepare": "npm run compile", - "flush": "rm -fr db.sqlite3* shardeum.sqlite*" + "flush": "rm -fr db.sqlite3* shardeum.sqlite* data-logs/" }, "dependencies": { "@ethereumjs/block": "^5.0.0", diff --git a/src/storage/transaction.ts b/src/storage/transaction.ts index d65ff7d..c809ff1 100644 --- a/src/storage/transaction.ts +++ b/src/storage/transaction.ts @@ -462,8 +462,8 @@ export async function queryTransactions( // address, // address, // ]) - const sql = `SELECT * FROM transactions WHERE transactionType!=? AND (txFrom=? OR txTo=? OR nominee=?)` - transactions = await db.get(sql, [TransactionType.InternalTxReceipt, address, address, address]) + const sql = `SELECT * FROM transactions WHERE transactionType!=? AND (txFrom=? OR txTo=? OR nominee=?) ORDER BY cycle DESC, timestamp DESC LIMIT ${limit} OFFSET ${skip}` + transactions = await db.all(sql, [TransactionType.InternalTxReceipt, address, address, address]) } else if ( txType === TransactionSearchType.Receipt || txType === TransactionSearchType.NodeRewardReceipt ||