Skip to content

Commit

Permalink
Fix src, dst parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Dongri Jin <[email protected]>
  • Loading branch information
dongrie committed Nov 28, 2023
1 parent 07b8a79 commit dfcad6f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions core/naive-strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (st *NaiveStrategy) RelayPackets(src, dst *ProvableChain, rp *RelayPackets,
return nil, err
}

if doExecuteRelaySrc {
if doExecuteRelayDst {
msgs.Dst, err = collectPackets(srcCtx, src, rp.Src, dstAddress)
if err != nil {
logger.Error(
Expand All @@ -236,7 +236,7 @@ func (st *NaiveStrategy) RelayPackets(src, dst *ProvableChain, rp *RelayPackets,
}
}

if doExecuteRelayDst {
if doExecuteRelaySrc {
msgs.Src, err = collectPackets(dstCtx, dst, rp.Dst, srcAddress)
if err != nil {
logger.Error(
Expand Down Expand Up @@ -420,7 +420,7 @@ func logPacketsRelayed(src, dst Chain, num int, obj string, dir string) {
)
}

func (st *NaiveStrategy) RelayAcknowledgements(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteRelaySrc, doExecuteRelayDst bool) (*RelayMsgs, error) {
func (st *NaiveStrategy) RelayAcknowledgements(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteAckSrc, doExecuteAckDst bool) (*RelayMsgs, error) {
logger := GetChannelPairLogger(src, dst)
defer logger.TimeTrack(time.Now(), "RelayAcknowledgements", "num_src", len(rp.Src), "num_dst", len(rp.Dst))

Expand All @@ -445,13 +445,13 @@ func (st *NaiveStrategy) RelayAcknowledgements(src, dst *ProvableChain, rp *Rela
return nil, err
}

if !st.dstNoAck && doExecuteRelaySrc {
if !st.dstNoAck && doExecuteAckDst {
msgs.Dst, err = collectAcks(srcCtx, src, rp.Src, dstAddress)
if err != nil {
return nil, err
}
}
if !st.srcNoAck && doExecuteRelayDst {
if !st.srcNoAck && doExecuteAckSrc {
msgs.Src, err = collectAcks(dstCtx, dst, rp.Dst, srcAddress)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions core/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ func (srv *RelayService) shouldExecuteRelay(seqs *RelayPackets, srcRelayStartTim
}

// time interval
if time.Since(srcRelayStartTime.StartTime) >= srv.optimizeRelay.srcOptimizeInterval {
if srcRelayStartTime.AlreadySet && time.Since(srcRelayStartTime.StartTime) >= srv.optimizeRelay.srcOptimizeInterval {
srcRelay = true
}
if time.Since(dstRelayStartTime.StartTime) >= srv.optimizeRelay.dstOptimizeInterval {
if dstRelayStartTime.AlreadySet && time.Since(dstRelayStartTime.StartTime) >= srv.optimizeRelay.dstOptimizeInterval {
dstRelay = true
}

Expand Down
2 changes: 1 addition & 1 deletion core/strategies.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type StrategyI interface {
UnrelayedAcknowledgements(src, dst *ProvableChain, sh SyncHeaders, includeRelayedButUnfinalized bool) (*RelayPackets, error)

// RelayAcknowledgements executes AcknowledgePacket to the packets contained in `rp` on both chains (`src` and `dst`).
RelayAcknowledgements(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteRelaySrc, doExecuteRelayDst bool) (*RelayMsgs, error)
RelayAcknowledgements(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteAckSrc, doExecuteAckDst bool) (*RelayMsgs, error)

// UpdateClients executes UpdateClient only if needed
UpdateClients(src, dst *ProvableChain, doExecuteRelaySrc, doExecuteRelayDst, doExecuteAckSrc, doExecuteAckDst bool, sh SyncHeaders, doRefresh bool) (*RelayMsgs, error)
Expand Down

0 comments on commit dfcad6f

Please sign in to comment.