Skip to content

Commit 45acddd

Browse files
[Backport] Increase deposit sweep frequency (#3806)
This pull request backports #3803 to the `releases/mainnet/v2.0.1` branch.
2 parents c41edaf + 441fb59 commit 45acddd

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

pkg/tbtc/coordination.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,9 @@ func (ce *coordinationExecutor) getActionsChecklist(
540540
actions = append(actions, ActionRedemption)
541541

542542
// Other actions should be checked with a lower frequency. The default
543-
// frequency is every 16 coordination windows.
544-
frequencyWindows := uint64(16)
543+
// frequency is every 4 coordination windows.
544+
frequencyWindows := uint64(4)
545545

546-
// TODO: Consider increasing frequency for the active wallet in the future.
547546
if windowIndex%frequencyWindows == 0 {
548547
actions = append(actions, ActionDepositSweep)
549548
}

pkg/tbtc/coordination_test.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -557,18 +557,19 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
557557
coordinationBlock: 2700,
558558
expectedChecklist: []WalletActionType{ActionRedemption},
559559
},
560+
// Heartbeat randomly selected for the 4th coordination window.
560561
"block 3600": {
561562
coordinationBlock: 3600,
562563
expectedChecklist: []WalletActionType{
563564
ActionRedemption,
565+
ActionDepositSweep,
564566
ActionHeartbeat,
565567
},
566568
},
567569
"block 4500": {
568570
coordinationBlock: 4500,
569571
expectedChecklist: []WalletActionType{ActionRedemption},
570572
},
571-
// Heartbeat randomly selected for the 6th coordination window.
572573
"block 5400": {
573574
coordinationBlock: 5400,
574575
expectedChecklist: []WalletActionType{
@@ -581,7 +582,10 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
581582
},
582583
"block 7200": {
583584
coordinationBlock: 7200,
584-
expectedChecklist: []WalletActionType{ActionRedemption},
585+
expectedChecklist: []WalletActionType{
586+
ActionRedemption,
587+
ActionDepositSweep,
588+
},
585589
},
586590
"block 8100": {
587591
coordinationBlock: 8100,
@@ -597,13 +601,15 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
597601
},
598602
"block 10800": {
599603
coordinationBlock: 10800,
600-
expectedChecklist: []WalletActionType{ActionRedemption},
604+
expectedChecklist: []WalletActionType{
605+
ActionRedemption,
606+
ActionDepositSweep,
607+
},
601608
},
602609
"block 11700": {
603610
coordinationBlock: 11700,
604611
expectedChecklist: []WalletActionType{ActionRedemption},
605612
},
606-
// Heartbeat randomly selected for the 14th coordination window.
607613
"block 12600": {
608614
coordinationBlock: 12600,
609615
expectedChecklist: []WalletActionType{
@@ -614,14 +620,11 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
614620
coordinationBlock: 13500,
615621
expectedChecklist: []WalletActionType{ActionRedemption},
616622
},
617-
// 16th coordination window so, all actions should be on the checklist.
618623
"block 14400": {
619624
coordinationBlock: 14400,
620625
expectedChecklist: []WalletActionType{
621626
ActionRedemption,
622627
ActionDepositSweep,
623-
ActionMovedFundsSweep,
624-
ActionMovingFunds,
625628
},
626629
},
627630
}

pkg/tbtc/node.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,8 @@ func (n *node) handleRedemptionProposal(
610610

611611
// handleMovingFundsProposal handles an incoming moving funds proposal by
612612
// orchestrating and dispatching an appropriate wallet action.
613+
//
614+
//lint:ignore U1000 This function will be used in the future.
613615
func (n *node) handleMovingFundsProposal(
614616
wallet wallet,
615617
proposal *MovingFundsProposal,
@@ -678,6 +680,8 @@ func (n *node) handleMovingFundsProposal(
678680

679681
// handleMovedFundsSweepProposal handles an incoming moved funds sweep proposal
680682
// by orchestrating and dispatching an appropriate wallet action.
683+
//
684+
//lint:ignore U1000 This function will be used in the future.
681685
func (n *node) handleMovedFundsSweepProposal(
682686
wallet wallet,
683687
proposal *MovedFundsSweepProposal,

0 commit comments

Comments
 (0)