diff --git a/core/naive-strategy.go b/core/naive-strategy.go index 3365e532..0fffbf1b 100644 --- a/core/naive-strategy.go +++ b/core/naive-strategy.go @@ -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( @@ -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( @@ -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)) @@ -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 diff --git a/core/service.go b/core/service.go index c0425927..93e68b9b 100644 --- a/core/service.go +++ b/core/service.go @@ -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 } diff --git a/core/strategies.go b/core/strategies.go index f344ff2f..c469624b 100644 --- a/core/strategies.go +++ b/core/strategies.go @@ -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)