This pull request ports some changes from the main state snapshot
integration one, specifically introducing the flat state tracking
in pathdb.
Note, the tracked flat state changes are only held in memory and
won't be persisted in the disk. Meanwhile, the correspoding state
retrieval in persistent state is also not supported yet. The states
management in disk is more complicated and will be implemented in
a separate pull request.