Basically the changes for https://github.com/cosmos/ibc-go/issues/5310 (this would close https://github.com/cosmos/ibc/pull/939)