6

I have been looking through that web3.eth.filter function, and ran into a bit of a wall:

var options = {
  fromBlock: "pending",
  toBlock: "latest",
  address: "0xab1323fe3234234234fa34324324234af3423432",
};
var filter = web3.eth.filter(options);

in regards to the "pending" and "latest" strings, this is the definition I got from github:

latest may be given to mean the most recent and pending currently mining, block

source: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethfilter

QUESTION:

What does that actually mean? If I run geth for instance and there are a bunch of blocks pending to be added to the blockchain, lets imagine each "-" represents 1 block in the following example:

- - - - - - - - -

If I had fromBlock: "pending" to toBlock: "latest", would that mean the following:

(start here) - - - - - - - - - (end here)

But if that were the case, there would be more blocks added by the time the end is reached:

(start here) - - - - - - - - - (end here) - -

So would latest mean continue forever or stop on the one that was the latest when the filter was actually created ?

1 Answer 1

1

The term latest "dynamically updates". That's why if you call web3.eth.filter(...).watch() you'll find new logs added. At least, this is what I see using testrpc. You may experience delays on the mainnet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.