mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
htlc: move enum side crom daemon/channel.h to daemon/htlc.h
lightningd wants htlcs, but not the old struct channel. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
7d68554787
commit
940053d000
@ -2,19 +2,12 @@
|
||||
#define LIGHTNING_DAEMON_CHANNEL_H
|
||||
#include "config.h"
|
||||
#include "bitcoin/locktime.h"
|
||||
#include "daemon/htlc.h"
|
||||
#include <assert.h>
|
||||
#include <ccan/crypto/sha256/sha256.h>
|
||||
#include <ccan/str/str.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct htlc;
|
||||
|
||||
enum side {
|
||||
LOCAL,
|
||||
REMOTE
|
||||
};
|
||||
|
||||
struct channel_oneside {
|
||||
/* Payment and fee is in millisatoshi. */
|
||||
uint32_t pay_msat, fee_msat;
|
||||
@ -144,21 +137,4 @@ void force_add_htlc(struct channel_state *cstate, const struct htlc *htlc);
|
||||
void force_fail_htlc(struct channel_state *cstate, const struct htlc *htlc);
|
||||
void force_fulfill_htlc(struct channel_state *cstate, const struct htlc *htlc);
|
||||
bool balance_after_force(struct channel_state *cstate);
|
||||
|
||||
static inline const char *side_to_str(enum side side)
|
||||
{
|
||||
switch (side) {
|
||||
case LOCAL: return "LOCAL";
|
||||
case REMOTE: return "REMOTE";
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
static inline enum side str_to_side(const char *str)
|
||||
{
|
||||
if (streq(str, "LOCAL"))
|
||||
return LOCAL;
|
||||
assert(streq(str, "REMOTE"));
|
||||
return REMOTE;
|
||||
}
|
||||
#endif /* LIGHTNING_DAEMON_CHANNEL_H */
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define LIGHTNING_COMMIT_TX_H
|
||||
#include "config.h"
|
||||
#include "htlc.h"
|
||||
#include <ccan/tal/tal.h>
|
||||
|
||||
struct channel_state;
|
||||
struct sha256;
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define LIGHTNING_DAEMON_HTLC_H
|
||||
#include "config.h"
|
||||
#include "bitcoin/locktime.h"
|
||||
#include "channel.h"
|
||||
#include "htlc_state.h"
|
||||
#include "pseudorand.h"
|
||||
#include <assert.h>
|
||||
@ -10,6 +9,13 @@
|
||||
#include <ccan/crypto/siphash24/siphash24.h>
|
||||
#include <ccan/htable/htable_type.h>
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <ccan/str/str.h>
|
||||
|
||||
enum side {
|
||||
LOCAL,
|
||||
REMOTE,
|
||||
NUM_SIDES
|
||||
};
|
||||
|
||||
/* What are we doing: adding or removing? */
|
||||
#define HTLC_ADDING 0x400
|
||||
@ -143,4 +149,23 @@ static inline bool htlc_is_dead(const struct htlc *htlc)
|
||||
return htlc->state == RCVD_REMOVE_ACK_REVOCATION
|
||||
|| htlc->state == SENT_REMOVE_ACK_REVOCATION;
|
||||
}
|
||||
|
||||
|
||||
static inline const char *side_to_str(enum side side)
|
||||
{
|
||||
switch (side) {
|
||||
case LOCAL: return "LOCAL";
|
||||
case REMOTE: return "REMOTE";
|
||||
case NUM_SIDES: break;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
static inline enum side str_to_side(const char *str)
|
||||
{
|
||||
if (streq(str, "LOCAL"))
|
||||
return LOCAL;
|
||||
assert(streq(str, "REMOTE"));
|
||||
return REMOTE;
|
||||
}
|
||||
#endif /* LIGHTNING_DAEMON_HTLC_H */
|
||||
|
Loading…
Reference in New Issue
Block a user