mirror of https://github.com/embarklabs/embark.git
Only fetch transactions from last 100th blocks
This commit is contained in:
parent
4ed329c21d
commit
6a97930ceb
|
@ -7,6 +7,8 @@ const embarkJsUtils = require('embarkjs').Utils;
|
||||||
|
|
||||||
const WEB3_READY = 'blockchain:ready';
|
const WEB3_READY = 'blockchain:ready';
|
||||||
|
|
||||||
|
const BLOCK_LIMIT = 100;
|
||||||
|
|
||||||
// TODO: consider another name, this is the blockchain connector
|
// TODO: consider another name, this is the blockchain connector
|
||||||
class BlockchainConnector {
|
class BlockchainConnector {
|
||||||
constructor(embark, options) {
|
constructor(embark, options) {
|
||||||
|
@ -481,7 +483,7 @@ class BlockchainConnector {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(blockNumber, account, next) {
|
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);
|
account.transactions = transactions.filter((transaction) => transaction.from === address);
|
||||||
next(null, account);
|
next(null, account);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue