peer: handle fulfull and fail onchain.

We now need to use bitcoin_witness_htlc with the r value, so that API
is updated to take 'struct rval' or 'struct sha256'.

We use the nc->delay amount (ie. dstate->config.min_htlc_expiry) to
wait for a timeout refund to be buried before "failing" upstream.
This should probably be made into a clearer parameter rather than
overloading this one.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


Header from folded patch 'dont-use-peer-nc-in-onchain-code.patch':

peer: Don't use peer->nc->delay for onchain case.

Use the config var directly.  We should be freeing peer->nc when the
connection dies anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-07-01 11:16:58 +09:30
parent 4f1a1ec044
commit caf50c9ae4
5 changed files with 168 additions and 37 deletions

View File

@@ -89,7 +89,7 @@ u8 **bitcoin_witness_secret(const tal_t *ctx,
/* Create a witness which spends bitcoin_redeeem_htlc_recv/send */
u8 **bitcoin_witness_htlc(const tal_t *ctx,
const struct sha256 *htlc_or_revocation_preimage,
const void *htlc_or_revocation_preimage,
const struct bitcoin_signature *sig,
const u8 *witnessscript);