1
0

lnworker: rename 'invoices' to 'payments' when they can be in both directions

This commit is contained in:
ThomasV
2019-10-09 20:16:11 +02:00
parent 788d54f9a6
commit 638de63f13
4 changed files with 40 additions and 43 deletions

View File

@@ -21,7 +21,7 @@ from electrum.channel_db import ChannelDB
from electrum.lnworker import LNWallet
from electrum.lnmsg import encode_msg, decode_msg
from electrum.logging import console_stderr_handler
from electrum.lnworker import InvoiceInfo, RECEIVED, PR_UNPAID
from electrum.lnworker import PaymentInfo, RECEIVED, PR_UNPAID
from .test_lnchannel import create_test_channels
from . import ElectrumTestCase
@@ -88,8 +88,7 @@ class MockLNWallet:
self.node_keypair = local_keypair
self.network = MockNetwork(tx_queue)
self.channels = {self.chan.channel_id: self.chan}
self.invoices = {}
self.inflight = {}
self.payments = {}
self.wallet = MockWallet()
self.localfeatures = LnLocalFeatures(0)
self.pending_payments = defaultdict(asyncio.Future)
@@ -120,13 +119,11 @@ class MockLNWallet:
def on_channels_updated(self):
pass
def save_invoice(*args, is_paid=False):
pass
preimages = {}
get_invoice_info = LNWallet.get_invoice_info
save_invoice_info = LNWallet.save_invoice_info
set_invoice_status = LNWallet.set_invoice_status
get_payment_info = LNWallet.get_payment_info
save_payment_info = LNWallet.save_payment_info
set_payment_status = LNWallet.set_payment_status
get_payment_status = LNWallet.get_payment_status
save_preimage = LNWallet.save_preimage
get_preimage = LNWallet.get_preimage
_create_route_from_invoice = LNWallet._create_route_from_invoice
@@ -216,9 +213,9 @@ class TestPeer(ElectrumTestCase):
amount_btc = amount_sat/Decimal(COIN)
payment_preimage = os.urandom(32)
RHASH = sha256(payment_preimage)
info = InvoiceInfo(RHASH, amount_sat, RECEIVED, PR_UNPAID)
info = PaymentInfo(RHASH, amount_sat, RECEIVED, PR_UNPAID)
w2.save_preimage(RHASH, payment_preimage)
w2.save_invoice_info(info)
w2.save_payment_info(info)
lnaddr = LnAddr(
RHASH,
amount_btc,