fix livelock happens when merging node restarted during the process.

Yes it is, but the test is complicated and if I extract some methods we will lose ability to read/follow the flow.