Closed bitphage closed 4 years ago
Also, Transactionbuilder caches ref_block_num
and ref_block_prefix
in constructTx() with dict.update(self, self.tx.json())
. I don't see how this cache is invalidated, but I see from the logs the same ref_block_num
is being used from several hours to maybe a day.
Good find ... fixed
It appears the error was due to caching: ref_block was cached, and after "wraparound" ref_block_prefix
became invalid.
Despite the issue was addressed in b3d6cda4b6e7fb840dc8721b6ac864a4ee60c1fd, I started to get this this error time-to-time in my dexbot production instance.
Error means "referenced block num prefix != actual block prefix". Block prefix is taken from next block using "previous" field:
block = ws.get_block_header(int(dynBCParams["last_irreversible_block_num"])+1)
Some ambiguity is caused by referencing block num using only 16 bits. This means, referenced block num should not be older than 65535 from head block. The only way I can reproduce this issue artificially is by referring to some old block, like this:
dynBCParams["last_irreversible_block_num"] -= 70000
I'm not sure how it's happening in production, but I can guess there could be a reconnection to the next node and LIB on new node was shifted to the past (node out of sync). I added a debug to see LIB next time the issue will happen.