core-lightning/daemon/secrets.h
Rusty Russell caf50c9ae4 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>
2016-07-01 12:00:17 +09:30

58 lines
1.6 KiB
C

#ifndef LIGHTNING_DAEMON_SECRETS_H
#define LIGHTNING_DAEMON_SECRETS_H
/* Routines to handle private keys. */
#include "config.h"
#include <ccan/short_types/short_types.h>
struct peer;
struct lightningd_state;
struct signature;
struct sha256;
void privkey_sign(struct peer *peer, const void *src, size_t len,
struct signature *sig);
void peer_sign_theircommit(const struct peer *peer,
struct bitcoin_tx *commit,
struct signature *sig);
void peer_sign_ourcommit(const struct peer *peer,
struct bitcoin_tx *commit,
struct signature *sig);
void peer_sign_spend(const struct peer *peer,
struct bitcoin_tx *spend,
const u8 *commit_witnessscript,
struct signature *sig);
void peer_sign_htlc_refund(const struct peer *peer,
struct bitcoin_tx *spend,
const u8 *htlc_witnessscript,
struct signature *sig);
void peer_sign_htlc_fulfill(const struct peer *peer,
struct bitcoin_tx *spend,
const u8 *htlc_witnessscript,
struct signature *sig);
void peer_sign_mutual_close(const struct peer *peer,
struct bitcoin_tx *close,
struct signature *sig);
void peer_sign_steal_input(const struct peer *peer,
struct bitcoin_tx *spend,
size_t i,
const u8 *witnessscript,
struct signature *sig);
void peer_secrets_init(struct peer *peer);
void peer_get_revocation_hash(const struct peer *peer, u64 index,
struct sha256 *rhash);
void peer_get_revocation_preimage(const struct peer *peer, u64 index,
struct sha256 *preimage);
void secrets_init(struct lightningd_state *dstate);
#endif /* LIGHTNING_DAEMON_SECRETS_H */