Only fetch transactions from last 100th blocks

This commit is contained in:
Anthony Laibe 2018-10-22 11:54:28 +01:00 committed by Pascal Precht
parent 4ed329c21d
commit 6a97930ceb
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 3 additions and 1 deletions

View File

@ -7,6 +7,8 @@ const embarkJsUtils = require('embarkjs').Utils;
const WEB3_READY = 'blockchain:ready';
const BLOCK_LIMIT = 100;
// TODO: consider another name, this is the blockchain connector
class BlockchainConnector {
constructor(embark, options) {
@ -481,7 +483,7 @@ class BlockchainConnector {
});
},
function(blockNumber, account, next) {
self.getTransactions(blockNumber, blockNumber, (transactions) => {
self.getTransactions(blockNumber - BLOCK_LIMIT, BLOCK_LIMIT, (transactions) => {
account.transactions = transactions.filter((transaction) => transaction.from === address);
next(null, account);
});