Page MenuHomePhabricator

[electrum] simplify and inline InvoiceList.chkVisible
ClosedPublic

Authored by PiRK on Jul 7 2025, 15:07.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCacbd2ec2eaca: [electrum] simplify and inline InvoiceList.chkVisible
Summary

This method is poorly named (it does more than just checking the widget's visibility), it unnecessarily accesses the main window (its grandparent widget) API, and is needlesly complicated.

Fix these issues by:

  • letting the parent widget decide on whether the child should initially be visible
  • not checking for the main_window's visibility
  • adding a visibility_changed signal so the visibility of the label widget can automatically be connected to the visibility of the invoice list

Checking the main window's visibility is unnecessary, because (from the QWidget doc):

Calling setVisible(true) or show() sets the widget to visible status if all its parent widgets up to the window are visible. If an ancestor is not visible, the widget won't become visible until all its ancestors are shown.

Test Plan
$ curl -L -H 'Content-Type: application/json' -d '{"values":{"network":"XEC","outputs":[{"value":3000,"scriptHex":"76a914154205358162a6f59457d83dea828a15261aaba388ac"}]}}' https://p.be.cash/create-invoice
{"bitcoinUri":"ecash:?r=https://p.be.cash/i/QRPJCg","wsUrl":"wss://p.be.cash/ws/QRPJCg","invoiceId":"QRPJCg"}

Paste the ecash:?r=https://p.be.cash/i/QRPJCg URI in the send tab, check that the invoices list and label become visible at the bottom.
Right click on the invoice and choose the Delete action, check that the widgets disappear.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jul 7 2025, 15:07

Note that I needed a small patch to test this to bypass a SSL cert expiration check, as this bip70 server does currently not have a fresh certificate.

diff --git a/electrum/electrumabc/x509.py b/electrum/electrumabc/x509.py
index d7d98a22be..4bb2068a28 100644
--- a/electrum/electrumabc/x509.py
+++ b/electrum/electrumabc/x509.py
@@ -380,13 +380,13 @@ class X509(object):
                     time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(not_before)),
                 )
             )
-        if not_after <= now:
-            raise CertificateError(
-                "Certificate for {} has expired at {}".format(
-                    self.get_common_name(),
-                    time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(not_after)),
-                )
-            )
+        # if not_after <= now:
+        #     raise CertificateError(
+        #         "Certificate for {} has expired at {}".format(
+        #             self.get_common_name(),
+        #             time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(not_after)),
+        #         )
+        #     )

     def getFingerprint(self):
         return hashlib.sha1(self.bytes).digest()
This revision is now accepted and ready to land.Jul 8 2025, 07:41