onchaind: fulfill HTLCs onchain.

When we see an offered HTLC onchain, we need to use the preimage if we
know it.  So we dump all the known HTLC preimages at startup, and send
new ones as we discover them.

This doesn't cover preimages we know because we're the final
recipient; that can happen if an HTLC hasn't been irrevocably
committed yet.  We'll do that in a followup patch.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-09-20 14:15:41 +09:30
parent 6ef64cd52b
commit a76a53a933
6 changed files with 317 additions and 112 deletions

View File

@@ -243,6 +243,7 @@ class LightningNode(object):
self.daemon = daemon
self.bitcoin = btc
self.executor = executor
self.known_fail = False
# Use batch if you're doing more than one async.
def connect(self, remote_node, capacity, async=False):
@@ -307,3 +308,9 @@ class LightningNode(object):
c.close()
db.close()
return result
def has_failed(self):
"""Note that a daemon has (deliberately) crashed, so we don't fail
on cleanup"""
self.known_fail = True