If the upgrade changes the ordering, the recv sequence and ack sequences need to be appropriately set since there is different expected behavior from the previous channel logic and the new channel logic.
If moving from UNORDERED to ORDERED:
The NextSequenceRecv needs to be set to the counterpartyNextSequenceSend on ChanUpgradeOpen since the packets on both sides have all flushed, we can be sure that the next packet we are set to receive will be the first packet the counterparty sends after reopening.
Similarly, the NextSequenceAck should be our own NextSequenceSend since we can be sure that the counterparty processed all sent packets after flushing completes.
If moving from ORDERED to UNORDRED:
We simply reset NextSequenceRecv and NextSequenceAck to 1 to maintain consistency with other UNORDERED channels
If the upgrade changes the ordering, the recv sequence and ack sequences need to be appropriately set since there is different expected behavior from the previous channel logic and the new channel logic.
If moving from UNORDERED to ORDERED: The NextSequenceRecv needs to be set to the counterpartyNextSequenceSend on ChanUpgradeOpen since the packets on both sides have all flushed, we can be sure that the next packet we are set to receive will be the first packet the counterparty sends after reopening. Similarly, the NextSequenceAck should be our own NextSequenceSend since we can be sure that the counterparty processed all sent packets after flushing completes.
If moving from ORDERED to UNORDRED: We simply reset
NextSequenceRecv
andNextSequenceAck
to 1 to maintain consistency with other UNORDERED channels