It can be fixed in three ways:
- the bad way - look for existence of parallel
comment_cashout_objectwhen archiving a comment - if it is present, it means we are before cashout (in current reality). It is bad, because it wastes time on looking for objects to avoid situation that will never happen in real life - the clean way - add new
on_fork_switch()event tocomments_handlerinterface and call it nearnotify_switch_fork(). It basically allows to introduce undo where it is now missing - remove entries in ready-to-migrate map for blocks past bottom of fork switch (top block common to both chain realities). The main drawback of that solution is that the unit test we have now would still be failing, because it only emulates fork switches, does not actually execute them. Not the valid reason to not consider that solution, I know. - the easy way - since cashouts are time based, instead of remembering block numbers, we should remember timestamps in ready-to-migrate map. Comment migration would only happen when the block with timestamp of the intended cashout time becomes irreversible (actual cashout can never happen earlier, and can happen later only if all blocks between its intended cashout and actual cashout were missing)
RE: Comment archive - for node operators and technical