Skip to content

Commit 2b4faa8

Browse files
Prevent moving funds if there are unswept deposits (#3792)
This PR prevents the wallet running the moving funds procedure if the wallet has unswept deposits.
2 parents 0a488cc + fc5d55e commit 2b4faa8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pkg/tbtcpg/moving_funds.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,27 @@ func (mft *MovingFundsTask) Run(request *tbtc.CoordinationProposalRequest) (
103103
return nil, false, nil
104104
}
105105

106+
// The wallet should not have any unswept deposits.
107+
unsweptDeposits, err := FindDeposits(
108+
mft.chain,
109+
mft.btcChain,
110+
walletPublicKeyHash,
111+
0,
112+
true,
113+
true,
114+
)
115+
if err != nil {
116+
return nil, false, fmt.Errorf(
117+
"cannot check wallet's unswept deposits: [%w]",
118+
err,
119+
)
120+
}
121+
122+
if len(unsweptDeposits) > 0 {
123+
taskLogger.Infof("source wallet has unswept deposits")
124+
return nil, false, nil
125+
}
126+
106127
walletMainUtxo, err := tbtc.DetermineWalletMainUtxo(
107128
walletPublicKeyHash,
108129
mft.chain,

0 commit comments

Comments
 (0)