1
0

tests: set low wallet.gap_limit_for_change to speed up tests

This commit is contained in:
SomberNight
2025-08-08 16:24:50 +00:00
parent 4800a2d9c6
commit 4f1cc8b9cb
9 changed files with 141 additions and 112 deletions

View File

@@ -1,16 +1,18 @@
import os
import time
from . import ElectrumTestCase
from electrum.simple_config import SimpleConfig
from electrum.wallet import restore_wallet_from_text, Standard_Wallet, Abstract_Wallet
from electrum.wallet import Standard_Wallet, Abstract_Wallet
from electrum.invoices import PR_UNPAID, PR_PAID, PR_UNCONFIRMED, BaseInvoice, Invoice, LN_EXPIRY_NEVER
from electrum.address_synchronizer import TX_HEIGHT_UNCONFIRMED
from electrum.transaction import Transaction, PartialTxOutput
from electrum.util import TxMinedInfo, InvoiceError
from electrum.fee_policy import FixedFeePolicy
from . import ElectrumTestCase
from . import restore_wallet_from_text__for_unittest
class TestWalletPaymentRequests(ElectrumTestCase):
"""test 'incoming' invoices"""
TESTNET = True
@@ -28,7 +30,7 @@ class TestWalletPaymentRequests(ElectrumTestCase):
def create_wallet2(self) -> Standard_Wallet:
text = 'cross end slow expose giraffe fuel track awake turtle capital ranch pulp'
d = restore_wallet_from_text(text, path=self.wallet2_path, gap_limit=2, config=self.config)
d = restore_wallet_from_text__for_unittest(text, path=self.wallet2_path, config=self.config)
wallet2 = d['wallet'] # type: Standard_Wallet
# bootstrap wallet
funding_tx = Transaction('0200000000010132515e6aade1b79ec7dd3bac0896d8b32c56195d23d07d48e21659cef24301560100000000fdffffff0112841e000000000016001477fe6d2a27e8860c278d4d2cd90bad716bb9521a02473044022041ed68ef7ef122813ac6a5e996b8284f645c53fbe6823b8e430604a8915a867802203233f5f4d347a687eb19b2aa570829ab12aeeb29a24cc6d6d20b8b3d79e971ae012102bee0ee043817e50ac1bb31132770f7c41e35946ccdcb771750fb9696bdd1b307ad951d00')
@@ -39,7 +41,7 @@ class TestWalletPaymentRequests(ElectrumTestCase):
async def test_wallet_with_ln_creates_payreq_and_gets_paid_on_ln(self):
text = 'bitter grass shiver impose acquire brush forget axis eager alone wine silver'
d = restore_wallet_from_text(text, path=self.wallet1_path, gap_limit=2, config=self.config)
d = restore_wallet_from_text__for_unittest(text, path=self.wallet1_path, config=self.config)
wallet1 = d['wallet'] # type: Standard_Wallet
self.assertIsNotNone(wallet1.lnworker)
self.assertTrue(wallet1.has_lightning())
@@ -56,7 +58,7 @@ class TestWalletPaymentRequests(ElectrumTestCase):
async def test_wallet_with_ln_creates_payreq_and_gets_paid_onchain(self):
text = 'bitter grass shiver impose acquire brush forget axis eager alone wine silver'
d = restore_wallet_from_text(text, path=self.wallet1_path, gap_limit=2, config=self.config)
d = restore_wallet_from_text__for_unittest(text, path=self.wallet1_path, config=self.config)
wallet1 = d['wallet'] # type: Standard_Wallet
wallet1.db.put('stored_height', 1000)
self.assertIsNotNone(wallet1.lnworker)
@@ -87,7 +89,7 @@ class TestWalletPaymentRequests(ElectrumTestCase):
async def test_wallet_without_ln_creates_payreq_and_gets_paid_onchain(self):
text = 'cycle rocket west magnet parrot shuffle foot correct salt library feed song'
d = restore_wallet_from_text(text, path=self.wallet1_path, gap_limit=2, config=self.config)
d = restore_wallet_from_text__for_unittest(text, path=self.wallet1_path, config=self.config)
wallet1 = d['wallet'] # type: Standard_Wallet
wallet1.db.put('stored_height', 1000)
self.assertIsNone(wallet1.lnworker)
@@ -118,7 +120,7 @@ class TestWalletPaymentRequests(ElectrumTestCase):
async def test_wallet_gets_paid_onchain_in_the_past(self):
text = 'bitter grass shiver impose acquire brush forget axis eager alone wine silver'
d = restore_wallet_from_text(text, path=self.wallet1_path, gap_limit=2, config=self.config)
d = restore_wallet_from_text__for_unittest(text, path=self.wallet1_path, config=self.config)
wallet1 = d['wallet'] # type: Standard_Wallet
wallet1.db.put('stored_height', 1000)
self.assertIsNotNone(wallet1.lnworker)
@@ -148,7 +150,7 @@ class TestWalletPaymentRequests(ElectrumTestCase):
async def test_wallet_reuse_addr_of_expired_request(self):
text = 'bitter grass shiver impose acquire brush forget axis eager alone wine silver'
d = restore_wallet_from_text(text, path=self.wallet1_path, gap_limit=3, config=self.config)
d = restore_wallet_from_text__for_unittest(text, path=self.wallet1_path, gap_limit=3, config=self.config)
wallet1 = d['wallet'] # type: Standard_Wallet
self.assertIsNotNone(wallet1.lnworker)
self.assertTrue(wallet1.has_lightning())
@@ -176,7 +178,7 @@ class TestWalletPaymentRequests(ElectrumTestCase):
async def test_wallet_get_request_by_addr(self):
text = 'bitter grass shiver impose acquire brush forget axis eager alone wine silver'
d = restore_wallet_from_text(text, path=self.wallet1_path, gap_limit=3, config=self.config)
d = restore_wallet_from_text__for_unittest(text, path=self.wallet1_path, gap_limit=3, config=self.config)
wallet1 = d['wallet'] # type: Standard_Wallet
self.assertIsNotNone(wallet1.lnworker)
self.assertTrue(wallet1.has_lightning())