Simplify invoices and requests.
- We need only two types: PR_TYPE_ONCHAIN and PR_TYPE_LN - BIP70 is no longer a type, but an optional field in the dict - Invoices in the wallet are indexed by a hash of their serialized list of outputs. - Requests are still indexed by address, because we never generate Paytomany requests. - Add 'clear_invoices' command to CLI - Add 'save invoice' button to Qt
This commit is contained in:
@@ -41,7 +41,6 @@ except ImportError:
|
||||
from . import bitcoin, ecc, util, transaction, x509, rsakey
|
||||
from .util import bh2u, bfh, export_meta, import_meta, make_aiohttp_session
|
||||
from .util import PR_UNPAID, PR_EXPIRED, PR_PAID, PR_UNKNOWN, PR_INFLIGHT
|
||||
from .util import PR_TYPE_BIP70
|
||||
from .crypto import sha256
|
||||
from .bitcoin import TYPE_ADDRESS
|
||||
from .transaction import TxOutput
|
||||
@@ -151,10 +150,6 @@ class PaymentRequest:
|
||||
self.memo = self.details.memo
|
||||
self.payment_url = self.details.payment_url
|
||||
|
||||
def is_pr(self):
|
||||
return self.get_amount() != 0
|
||||
#return self.get_outputs() != [(TYPE_ADDRESS, self.get_requestor(), self.get_amount())]
|
||||
|
||||
def verify(self, contacts):
|
||||
if self.error:
|
||||
return False
|
||||
@@ -269,19 +264,6 @@ class PaymentRequest:
|
||||
def get_memo(self):
|
||||
return self.memo
|
||||
|
||||
def get_dict(self):
|
||||
return {
|
||||
'type': PR_TYPE_BIP70,
|
||||
'id': self.get_id(),
|
||||
'requestor': self.get_requestor(),
|
||||
'message': self.get_memo(),
|
||||
'time': self.get_time(),
|
||||
'exp': self.get_expiration_date() - self.get_time(),
|
||||
'amount': self.get_amount(),
|
||||
'outputs': self.get_outputs(),
|
||||
'hex': self.raw.hex(),
|
||||
}
|
||||
|
||||
def get_id(self):
|
||||
return self.id if self.requestor else self.get_address()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user