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

@@ -487,7 +487,7 @@ u8 **bitcoin_witness_secret(const tal_t *ctx,
}
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)
{
@@ -498,8 +498,7 @@ u8 **bitcoin_witness_htlc(const tal_t *ctx,
htlc_or_revocation_preimage = &no_preimage;
return bitcoin_witness_secret(ctx, htlc_or_revocation_preimage,
sizeof(*htlc_or_revocation_preimage), sig,
witnessscript);
32, sig, witnessscript);
}
bool scripteq(const u8 *s1, size_t s1len, const u8 *s2, size_t s2len)