mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 08:51:32 +00:00
import paymentrequests only when really needed
This commit is contained in:
parent
58c302a4cf
commit
36cee62849
2 changed files with 11 additions and 12 deletions
|
@ -41,9 +41,6 @@ from electrum import mnemonic
|
||||||
from electrum import util, bitcoin, commands, Interface, Wallet
|
from electrum import util, bitcoin, commands, Interface, Wallet
|
||||||
from electrum import SimpleConfig, Wallet, WalletStorage
|
from electrum import SimpleConfig, Wallet, WalletStorage
|
||||||
|
|
||||||
from electrum.paymentrequest import PR_UNPAID, PR_PAID
|
|
||||||
|
|
||||||
|
|
||||||
from electrum import bmp, pyqrnative
|
from electrum import bmp, pyqrnative
|
||||||
|
|
||||||
from amountedit import AmountEdit, BTCAmountEdit, MyLineEdit
|
from amountedit import AmountEdit, BTCAmountEdit, MyLineEdit
|
||||||
|
@ -65,6 +62,16 @@ elif platform.system() == 'Darwin':
|
||||||
else:
|
else:
|
||||||
MONOSPACE_FONT = 'monospace'
|
MONOSPACE_FONT = 'monospace'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# status of payment requests
|
||||||
|
PR_UNPAID = 0
|
||||||
|
PR_EXPIRED = 1
|
||||||
|
PR_SENT = 2 # sent but not propagated
|
||||||
|
PR_PAID = 3 # send and propagated
|
||||||
|
PR_ERROR = 4 # could not parse
|
||||||
|
|
||||||
|
|
||||||
from electrum import ELECTRUM_VERSION
|
from electrum import ELECTRUM_VERSION
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,6 @@ import x509
|
||||||
REQUEST_HEADERS = {'Accept': 'application/bitcoin-paymentrequest', 'User-Agent': 'Electrum'}
|
REQUEST_HEADERS = {'Accept': 'application/bitcoin-paymentrequest', 'User-Agent': 'Electrum'}
|
||||||
ACK_HEADERS = {'Content-Type':'application/bitcoin-payment','Accept':'application/bitcoin-paymentack','User-Agent':'Electrum'}
|
ACK_HEADERS = {'Content-Type':'application/bitcoin-payment','Accept':'application/bitcoin-paymentack','User-Agent':'Electrum'}
|
||||||
|
|
||||||
# status can be:
|
|
||||||
PR_UNPAID = 0
|
|
||||||
PR_EXPIRED = 1
|
|
||||||
PR_SENT = 2 # sent but not propagated
|
|
||||||
PR_PAID = 3 # send and propagated
|
|
||||||
PR_ERROR = 4 # could not parse
|
|
||||||
|
|
||||||
|
|
||||||
ca_list = {}
|
ca_list = {}
|
||||||
ca_path = os.path.expanduser("~/.electrum/ca/ca-bundle.crt")
|
ca_path = os.path.expanduser("~/.electrum/ca/ca-bundle.crt")
|
||||||
|
@ -64,7 +57,6 @@ ca_path = os.path.expanduser("~/.electrum/ca/ca-bundle.crt")
|
||||||
|
|
||||||
|
|
||||||
def load_certificates():
|
def load_certificates():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ca_f = open(ca_path, 'r')
|
ca_f = open(ca_path, 'r')
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -84,7 +76,7 @@ def load_certificates():
|
||||||
try:
|
try:
|
||||||
x.parse(c)
|
x.parse(c)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print "cannot parse cert:", e
|
util.print_error("cannot parse cert:", e)
|
||||||
ca_list[x.getFingerprint()] = x
|
ca_list[x.getFingerprint()] = x
|
||||||
ca_f.close()
|
ca_f.close()
|
||||||
util.print_error("%d certificates"%len(ca_list))
|
util.print_error("%d certificates"%len(ca_list))
|
||||||
|
|
Loading…
Add table
Reference in a new issue