Skip to content

Commit

Permalink
ICS 04 (upgrades): fix counterparty connection hops in `chanUpgradeOp…
Browse files Browse the repository at this point in the history
…en` (#1008)

* fix connection hops

* add clarification to comment
  • Loading branch information
crodriguezvega authored Jul 31, 2023
1 parent 0ce921d commit 8cadde5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/core/ics-004-channel-and-packet-semantics/UPGRADES.md
Original file line number Diff line number Diff line change
Expand Up @@ -825,12 +825,16 @@ function chanUpgradeOpen(
// get upgrade since counterparty should have upgraded to these parameters
upgrade = provableStore.get(channelUpgradePath(portIdentifier, channelIdentifier))

// get the counterparty's connection hops for the proposed upgrade connection
proposedConnection = provableStore.get(connectionPath(upgrade.fields.connectionHops))
counterpartyHops = [proposedConnection.counterpartyConnectionIdentifier]

counterpartyChannel = ChannelEnd{
state: OPEN,
ordering: upgrade.fields.ordering,
counterpartyPortIdentifier: portIdentifier,
counterpartyChannelIdentifier: channelIdentifier,
connectionHops: upgrade.fields.connectionHops,
connectionHops: counterpartyHops,
version: upgrade.fields.version,
sequence: channel.upgradeSequence,
}
Expand Down Expand Up @@ -961,7 +965,7 @@ function timeoutChannelUpgrade(

// counterparty channel must be proved to not have completed flushing after timeout has passed
abortTransactionUnless(counterpartyChannel.state !== FLUSHCOMPLETE)
// if counterparty channel state is OPEN, we should abort
// if counterparty channel state is OPEN, we should abort the tx
// only if the counterparty has successfully completed upgrade
if counterpartyChannel.state === OPEN {
// get upgrade since counterparty should have upgraded to these parameters
Expand Down

0 comments on commit 8cadde5

Please sign in to comment.