Context
Currently, _createHorizonTopologyChangePromiseMapping() uses the _selfIndex to get the current horizons mapping. This function is called from _errorOnPromisesIfHorizonChanged(). However, in cases of reconfig, at this point we have updated the config but not yet updated our _selfIndex. As a result, we are using a potentially stale _selfIndex, which can lead to a crash.
Acceptance criteria
- Passing the correct self index into _createHorizonTopologyChangePromiseMapping() instead of using _selfIndex
- Calling _errorOnPromisesIfHorizonChanged() after _selfIndex has been updated
- Refactoring the code to avoid calling _createHorizonTopologyChangePromiseMapping() from _errorOnPromisesIfHorizonChanged(), since it is unclear why we need to construct it within _errorOnPromisesIfHorizonChanged() if we have additional logic later to do a similar job.
I am leaning towards option 3 since this code is a little confusing to understand.