Filter tokens logs from current block, not genesis (#6128) (#6141)

* Filter tokens logs from current block, not genesis

* Fix linting
This commit is contained in:
Arkadiy Paronyan 2017-07-25 13:08:39 +02:00 committed by GitHub
parent fdc781dbfd
commit 33a553726a

View File

@ -144,13 +144,16 @@ export function updateTokensFilter (_addresses, _tokens, options = {}) {
promises.push(api.eth.uninstallFilter(tokensFilter.filterToId));
}
const promise = Promise.all(promises);
Promise
.all([
api.eth.blockNumber()
].concat(promises))
.then(([ block ]) => {
const topicsFrom = [ TRANSFER_SIGNATURE, addresses, null ];
const topicsTo = [ TRANSFER_SIGNATURE, null, addresses ];
const filterOptions = {
fromBlock: 0,
fromBlock: block,
toBlock: 'pending',
address: tokenAddresses
};
@ -170,8 +173,8 @@ export function updateTokensFilter (_addresses, _tokens, options = {}) {
api.eth.newFilter(optionsTo)
]);
promise
.then(() => newFilters)
return newFilters;
})
.then(([ filterFromId, filterToId ]) => {
const nextTokensFilter = {
filterFromId, filterToId,