Basically, `devtools/reduce-includes.sh */*.c`. Build time from make clean (RUST=0) (includes building external libs): Before: real 0m38.944000-40.416000(40.1131+/-0.4)s user 3m6.790000-17.159000(15.0571+/-2.8)s sys 0m35.304000-37.336000(36.8942+/-0.57)s After: real 0m37.872000-39.974000(39.5466+/-0.59)s user 3m1.211000-14.968000(12.4556+/-3.9)s sys 0m35.008000-36.830000(36.4143+/-0.5)s Build time after touch config.vars (RUST=0): Before: real 0m19.831000-21.862000(21.5528+/-0.58)s user 2m15.361000-30.731000(28.4798+/-4.4)s sys 0m21.056000-22.339000(22.0346+/-0.35)s After: real 0m18.384000-21.307000(20.8605+/-0.92)s user 2m5.585000-26.843000(23.6017+/-6.7)s sys 0m19.650000-22.003000(21.4943+/-0.69)s Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
61 lines
2.1 KiB
C
61 lines
2.1 KiB
C
#include "config.h"
|
|
#include <bitcoin/psbt.h>
|
|
#include <bitcoin/short_channel_id.h>
|
|
#include <channeld/inflight.h>
|
|
#include <wire/wire.h>
|
|
|
|
struct inflight *fromwire_inflight(const tal_t *ctx, const u8 **cursor, size_t *max)
|
|
{
|
|
struct inflight *inflight = tal(ctx, struct inflight);
|
|
|
|
fromwire_bitcoin_outpoint(cursor, max, &inflight->outpoint);
|
|
fromwire_pubkey(cursor, max, &inflight->remote_funding);
|
|
inflight->amnt = fromwire_amount_sat(cursor, max);
|
|
inflight->remote_tx_sigs = fromwire_bool(cursor, max);
|
|
inflight->psbt = fromwire_wally_psbt(inflight, cursor, max);
|
|
inflight->splice_amnt = fromwire_s64(cursor, max);
|
|
int has_tx = fromwire_u8(cursor, max);
|
|
if(has_tx) {
|
|
inflight->last_tx = fromwire_bitcoin_tx(inflight, cursor, max);
|
|
fromwire_bitcoin_signature(cursor, max, &inflight->last_sig);
|
|
}
|
|
else {
|
|
inflight->last_tx = NULL;
|
|
memset(&inflight->last_sig, 0, sizeof(inflight->last_sig));
|
|
}
|
|
inflight->i_am_initiator = fromwire_bool(cursor, max);
|
|
inflight->force_sign_first = fromwire_bool(cursor, max);
|
|
int has_locked_scid = fromwire_u8(cursor, max);
|
|
if (has_locked_scid) {
|
|
inflight->locked_scid = tal(inflight, struct short_channel_id);
|
|
*inflight->locked_scid = fromwire_short_channel_id(cursor, max);
|
|
}
|
|
else {
|
|
inflight->locked_scid = NULL;
|
|
}
|
|
inflight->i_sent_sigs = fromwire_bool(cursor, max);
|
|
|
|
return inflight;
|
|
}
|
|
|
|
void towire_inflight(u8 **pptr, const struct inflight *inflight)
|
|
{
|
|
towire_bitcoin_outpoint(pptr, &inflight->outpoint);
|
|
towire_pubkey(pptr, &inflight->remote_funding);
|
|
towire_amount_sat(pptr, inflight->amnt);
|
|
towire_bool(pptr, inflight->remote_tx_sigs);
|
|
towire_wally_psbt(pptr, inflight->psbt);
|
|
towire_s64(pptr, inflight->splice_amnt);
|
|
towire_u8(pptr, inflight->last_tx ? 1 : 0);
|
|
if(inflight->last_tx) {
|
|
towire_bitcoin_tx(pptr, inflight->last_tx);
|
|
towire_bitcoin_signature(pptr, &inflight->last_sig);
|
|
}
|
|
towire_bool(pptr, inflight->i_am_initiator);
|
|
towire_bool(pptr, inflight->force_sign_first);
|
|
towire_u8(pptr, inflight->locked_scid ? 1 : 0);
|
|
if (inflight->locked_scid)
|
|
towire_short_channel_id(pptr, *inflight->locked_scid);
|
|
towire_bool(pptr, inflight->i_sent_sigs);
|
|
}
|