(htlc, plugin, **kwargs)
| 10 | |
| 11 | @plugin.hook('htlc_accepted') |
| 12 | def on_htlc_accepted(htlc, plugin, **kwargs): |
| 13 | preimage = b"\xAA" * 32 |
| 14 | payment_hash = sha256(preimage).hexdigest() |
| 15 | preimage = hexlify(preimage).decode('ASCII') |
| 16 | print("htlc_accepted called for payment_hash {}".format(htlc['payment_hash'])) |
| 17 | |
| 18 | if htlc['payment_hash'] == payment_hash: |
| 19 | return {'result': 'resolve', 'payment_key': preimage} |
| 20 | else: |
| 21 | return {'result': 'continue'} |
| 22 | |
| 23 | |
| 24 | plugin.run() |