@@ -227,18 +227,15 @@ func (m *Manager) recoverWithdrawals(ctx context.Context) error {
227227 }
228228
229229 // Group the deposits by their finalized withdrawal transaction.
230- depositsByWithdrawalTx := make (map [chainhash.Hash ][]* deposit.Deposit )
231- hash2tx := make (map [chainhash.Hash ]* wire.MsgTx )
230+ depositsByWithdrawalTx := make (map [* wire.MsgTx ][]* deposit.Deposit )
232231 for _ , d := range activeDeposits {
233232 withdrawalTx := d .FinalizedWithdrawalTx
234233 if withdrawalTx == nil {
235234 continue
236235 }
237- txid := withdrawalTx .TxHash ()
238- hash2tx [txid ] = withdrawalTx
239236
240- depositsByWithdrawalTx [txid ] = append (
241- depositsByWithdrawalTx [txid ], d ,
237+ depositsByWithdrawalTx [withdrawalTx ] = append (
238+ depositsByWithdrawalTx [withdrawalTx ], d ,
242239 )
243240 }
244241
@@ -247,7 +244,7 @@ func (m *Manager) recoverWithdrawals(ctx context.Context) error {
247244 eg := & errgroup.Group {}
248245
249246 // We can now reinstate each cluster of deposits for a withdrawal.
250- for txid , deposits := range depositsByWithdrawalTx {
247+ for tx , deposits := range depositsByWithdrawalTx {
251248 eg .Go (func () error {
252249 err := m .cfg .DepositManager .TransitionDeposits (
253250 ctx , deposits , deposit .OnWithdrawInitiated ,
@@ -257,11 +254,6 @@ func (m *Manager) recoverWithdrawals(ctx context.Context) error {
257254 return err
258255 }
259256
260- tx , ok := hash2tx [txid ]
261- if ! ok {
262- return fmt .Errorf ("can't find tx %v" , txid )
263- }
264-
265257 _ , err = m .publishFinalizedWithdrawalTx (ctx , tx )
266258 if err != nil {
267259 return err
0 commit comments