Repository: liberapay/liberapay.com

Issue:
Difficulty renewing donation in no longer accepted currency
I can't renew any donations because some people/organizations I pledged to can't currently receive them, but trying to renew to those who can goes to an error page that others can't, and stops there.


Discussion:
I see the problem. You have one donation up for renewal, but the recipient no longer accepts the currency you had chosen, so you have to modify the donation before renewing it, but the generic payment page (https://liberapay.com/about/me/giving/pay) isn't showing this donation at all.

While I work on a patch, you can overcome the problem by clicking on the “Modify” button of the renewable donation in your “Giving” page (https://liberapay.com/about/me/giving).

Resolving patch:
diff --git a/liberapay/models/participant.py b/liberapay/models/participant.py
--- a/liberapay/models/participant.py
+++ b/liberapay/models/participant.py
@@ -2200,10 +2200,10 @@ def update_avatar(self, src=None, cursor=None, avatar_email=None, check=True):
                 # Look up the SRV record to use.
                 email_domain = normalized_email.rsplit('@', 1)[1]
                 try:
-                    srv_records = DNS.query('_avatars-sec._tcp.'+email_domain, 'SRV')
+                    srv_records = DNS.resolve('_avatars-sec._tcp.'+email_domain, 'SRV')
                     scheme = 'https'
                 except Exception:
-                    srv_records = DNS.query('_avatars._tcp.'+email_domain, 'SRV')
+                    srv_records = DNS.resolve('_avatars._tcp.'+email_domain, 'SRV')
                     scheme = 'http'
                 # Filter down to just the records with the "highest" `.priority`
                 # (lower number = higher priority); for the libravatar API tells us:
@@ -3294,7 +3294,9 @@ def get_tips_awaiting_payment(self, weeks_early=3, exclude_recipients_of=None):
                         WHERE pt.payer = t.tipper
                           AND COALESCE(pt.team, pt.recipient) = t.tippee
                           AND ( pi.status IN ('awaiting_review', 'pending') OR
-                                pt.status IN ('awaiting_review', 'pending') )
+                                pt.status IN ('awaiting_review', 'pending') OR
+                                pi.status = 'succeeded' AND
+                                pi.ctime > (current_timestamp - interval '5 days') )
                         LIMIT 1
                    ){}
           ORDER BY ( SELECT 1
diff --git a/liberapay/utils/emails.py b/liberapay/utils/emails.py
--- a/liberapay/utils/emails.py
+++ b/liberapay/utils/emails.py
@@ -253,7 +253,7 @@ def get_email_server_addresses(email):
 
     """
     domain = email.domain
-    rrset = DNS.query(domain, 'MX', raise_on_no_answer=False).rrset
+    rrset = DNS.resolve(domain, 'MX', raise_on_no_answer=False).rrset
     if rrset:
         if len(rrset) == 1 and str(rrset[0].exchange) == '.':
             # This domain doesn't accept email. https://tools.ietf.org/html/rfc7505
@@ -298,11 +298,11 @@ def get_public_ip_addresses(domain):
     records = []
     exception = None
     try:
-        records.extend(DNS.query(domain, 'A', raise_on_no_answer=False).rrset or ())
+        records.extend(DNS.resolve(domain, 'A', raise_on_no_answer=False).rrset or ())
     except DNSException as e:
         exception = e
     try:
-        records.extend(DNS.query(domain, 'AAAA', raise_on_no_answer=False).rrset or ())
+        records.extend(DNS.resolve(domain, 'AAAA', raise_on_no_answer=False).rrset or ())
     except DNSException:
         if exception:
             raise exception from None


Test patch: