1
0

lnworker: make PaymentInfo dataclass

Move PaymentInfo from NamedTuple to dataclass to allow for easier
handling e.g. using dataclasses.astuple etc.
This commit is contained in:
f321x
2025-09-26 16:02:50 +02:00
committed by SomberNight
parent acd52da764
commit 4c0155c072
2 changed files with 46 additions and 9 deletions

View File

@@ -559,7 +559,12 @@ class TestPeer(ElectrumTestCase):
payment_preimage = os.urandom(32)
if payment_hash is None:
payment_hash = sha256(payment_preimage)
info = PaymentInfo(payment_hash, amount_msat, RECEIVED, PR_UNPAID)
info = PaymentInfo(
payment_hash=payment_hash,
amount_msat=amount_msat,
direction=RECEIVED,
status=PR_UNPAID,
)
if payment_preimage:
w2.save_preimage(payment_hash, payment_preimage)
w2.save_payment_info(info)