wallet_db upgrade: recalc keys of outgoing on-chain invoices
closes https://github.com/spesmilo/electrum/issues/7777
This commit is contained in:
@@ -41,7 +41,7 @@ except ImportError:
|
||||
|
||||
from . import bitcoin, constants, ecc, util, transaction, x509, rsakey
|
||||
from .util import bh2u, bfh, make_aiohttp_session
|
||||
from .invoices import Invoice
|
||||
from .invoices import Invoice, get_id_from_onchain_outputs
|
||||
from .crypto import sha256
|
||||
from .bitcoin import address_to_script
|
||||
from .transaction import PartialTxOutput
|
||||
@@ -135,7 +135,6 @@ class PaymentRequest:
|
||||
self.outputs = [] # type: List[PartialTxOutput]
|
||||
if self.error:
|
||||
return
|
||||
self.id = bh2u(sha256(r)[0:16])
|
||||
try:
|
||||
self.data = pb2.PaymentRequest()
|
||||
self.data.ParseFromString(r)
|
||||
@@ -275,8 +274,10 @@ class PaymentRequest:
|
||||
def get_memo(self):
|
||||
return self.memo
|
||||
|
||||
def get_id(self):
|
||||
return self.id if self.requestor else self.get_address()
|
||||
def get_name_for_export(self) -> Optional[str]:
|
||||
if not hasattr(self, 'details'):
|
||||
return None
|
||||
return get_id_from_onchain_outputs(self.outputs, timestamp=self.get_time())
|
||||
|
||||
def get_outputs(self):
|
||||
return self.outputs[:]
|
||||
|
||||
Reference in New Issue
Block a user