// CompleteAllPendingWithdrawals completes all pending withdrawals
// If the process is interrupted, it's possible that not all pending withdrawals will have gone out
// In that case, the ones that did not go out will remain as pending withdrawals
CompleteAllPendingWithdrawals completes all pending withdrawals
If the process is interrupted, it's possible that not all pending withdrawals will have gone out
In that case, the ones that did not go out will remain as pending withdrawals
// CompleteAllPendingWithdrawals completes all pending withdrawals // If the process is interrupted it ' s possible that not all pending withdrawals will have gone out // In that case the ones that did not go out will remain as pending withdrawals
func (w *WithdrawalHandler) CompleteAllPendingWithdrawals(ctxCtx context.Context) error {
	if w.completingPendingWithdrawals {
		return nil
	}
	w.completingPendingWithdrawals = true
	defer func() { w.completingPendingWithdrawals = false }()
	ctx, err := BeginTransaction(ctxCtx)
	if err != nil {
		return stacktrace.Propagate(err, "")
	}
	defer ctx.Commit() 
	pendingWithdrawals, err := types.GetPendingWithdrawals(ctx)
	if err != nil {
		return stacktrace.Propagate(err, "")
	}
	if len(pendingWithdrawals) == 0 {
		return nil
	}
	err = w.CompleteWithdrawals(ctxCtx, pendingWithdrawals)
	return stacktrace.Propagate(err, "")
}
func ( w * WithdrawalHandler ) CompleteAllPendingWithdrawals ( ctxCtx context . Context ) error { if w . completingPendingWithdrawals { return nil } w . completingPendingWithdrawals = true defer func ( ) { w . completingPendingWithdrawals = false } ( ) ctx , err := BeginTransaction ( ctxCtx ) if err != nil { return stacktrace . Propagate ( err , " " ) } defer ctx . Commit ( ) pendingWithdrawals , err := types . GetPendingWithdrawals ( ctx ) if err != nil { return stacktrace . Propagate ( err , " " ) } if len ( pendingWithdrawals ) == 0 { return nil } err = w . CompleteWithdrawals ( ctxCtx , pendingWithdrawals ) return stacktrace . Propagate ( err , " " ) }
CompleteAllPendingWithdrawals completes all pending withdrawals
If the process is interrupted, it's possible that not all pending withdrawals will have gone out
In that case, the ones that did not go out will remain as pending withdrawals
CompleteAllPendingWithdrawals completes all pending withdrawals If the process is interrupted it ' s possible that not all pending withdrawals will have gone out In that case the ones that did not go out will remain as pending withdrawals
// read-only tx EXCLUSIVELY for obtaining a list of pending withdrawals // CompleteWithdrawals should not use this transaction, it should use individual transactions internally // that will lock-delete the specific pending_withdrawal row as it proceeds