Does anyone know how long events can be retrieved for?
I have events on the Kovan contract at 0x86e5b6d7648b8b994886aeb98e2b4770675e608d and it appears I can no longer retrieve events older than 14 days?
The code I'm using is as follows. Both get and watch are not retrieving events that are older than 14 days. I don't have anything in between today and 14 days, so I don't know if it stopped retrieving events older than a few days, or if there's a limit.
Thanks in advance for any help.
UPDATE: Ok, it seems the issue was that Parity had a different meaning of "fully sync'd" than I thought. If you see a line such as
2017-11-02 15:31:11 #4098136 23/25 peers 301 MiB chain 83 MiB db 0 bytes queue 10 MiB sync RPC: 1 conn, 3 req/s, 142 µs
in the console output, then what it means is that Parity hasn't fully downloaded all the logs yet, and it has only downloaded the logs for block 4098136 (in this case), even though you see
2017-11-02 15:31:13 Imported #4569744 1c13…0e14 (0 txs, 0.00 Mgas, 0.81 ms, 0.57 KiB)
let ContractAddr = "0x86E5b6D7648b8B994886aeB98E2B4770675e608D"; // on Kovan
optionsShout = {
fromBlock: 4289879,
toBlock: 'latest',
address: ContractAddr,
topics: [web3.sha3('__Shout(string)')]
}
let filter, w;
function getLogs() {
var filter = web3.eth.filter(optionsShout);
console.log("getLogs...");
filter.get(function(error, event) {
if (!error) {
console.log("Event: " + event);
} else
{
console.log("Error: " + error);
}
})
}
function startFilter() {
console.log("Starting filter");
filter = web3.eth.filter(optionsShout);
filter.watch(function(error, event) {
if (!error) {
if (event.blockNumber > optionsShout.fromBlock) {
optionsShout.fromBlock = event.blockNumber;
displayEvent("event1", event);
}
} else
{
console.log("Error: "+error);
}
})
}
web3.eth.getSyncing(console.log). Just confirm that this returns 'false', just to be completely sure it's not a syncing problem. – carlolm Nov 01 '17 at 11:36