From 83b78fd3278344ed9f1345c3052f824d6c480b9b Mon Sep 17 00:00:00 2001 From: rbndg Date: Wed, 22 Apr 2020 11:01:57 +1000 Subject: [PATCH] Unpacking variable for cleaner code for testing --- contrib/plugins/helloworld.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/contrib/plugins/helloworld.py b/contrib/plugins/helloworld.py index 265afe511..73c4cc7c0 100755 --- a/contrib/plugins/helloworld.py +++ b/contrib/plugins/helloworld.py @@ -42,18 +42,14 @@ def on_disconnect(plugin, id, **kwargs): @plugin.subscribe("invoice_payment") def on_payment(plugin, invoice_payment, **kwargs): - plugin.log("Received invoice_payment event for label {}, preimage {}," - " and amount of {}".format(invoice_payment.get("label"), - invoice_payment.get("preimage"), - invoice_payment.get("msat"))) + plugin.log("Received invoice_payment event for label {label}, preimage {preimage}," + " and amount of {msat}".format(**invoice_payment)) @plugin.subscribe("invoice_creation") def on_invoice_creation(plugin, invoice_creation, **kwargs): - plugin.log("Received invoice_creation event for label {}, preimage {}," - " and amount of {}".format(invoice_creation.get("label"), - invoice_creation.get("preimage"), - invoice_creation.get("msat"))) + plugin.log("Received invoice_creation event for label {label}, preimage {preimage}," + " and amount of {msat}".format(**invoice_creation)) @plugin.hook("htlc_accepted")