mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
Version number, name, and build details.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
6883d28f6d
commit
1cb147c5b8
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ TAGS
|
||||
ccan/tools/configurator/configurator
|
||||
libsecp256k1.a
|
||||
libsecp256k1.la
|
||||
gen_*
|
||||
|
13
Makefile
13
Makefile
@ -1,4 +1,5 @@
|
||||
#! /usr/bin/make
|
||||
NAME=MtGox's Cold Wallet
|
||||
|
||||
# Needs to have oneof support: Ubuntu vivid's is too old :(
|
||||
PROTOCC:=protoc-c
|
||||
@ -12,11 +13,11 @@ PROGRAMS := test-cli/open-channel test-cli/create-anchor-tx test-cli/open-commit
|
||||
|
||||
BITCOIN_OBJS := bitcoin/address.o bitcoin/base58.o bitcoin/pubkey.o bitcoin/script.o bitcoin/shadouble.o bitcoin/signature.o bitcoin/tx.o
|
||||
|
||||
HELPER_OBJS := lightning.pb-c.o pkt.o permute_tx.o commit_tx.o opt_bits.o close_tx.o find_p2sh_out.o protobuf_convert.o funding.o test-cli/gather_updates.o
|
||||
HELPER_OBJS := lightning.pb-c.o pkt.o permute_tx.o commit_tx.o opt_bits.o close_tx.o find_p2sh_out.o protobuf_convert.o funding.o test-cli/gather_updates.o version.o
|
||||
|
||||
CCAN_OBJS := ccan-crypto-sha256.o ccan-crypto-shachain.o ccan-err.o ccan-tal.o ccan-tal-str.o ccan-take.o ccan-list.o ccan-str.o ccan-opt-helpers.o ccan-opt.o ccan-opt-parse.o ccan-opt-usage.o ccan-read_write_all.o ccan-str-hex.o ccan-tal-grab_file.o ccan-noerr.o ccan-crypto-ripemd160.o
|
||||
|
||||
HEADERS := $(wildcard *.h) $(wildcard bitcoin/*.h)
|
||||
HEADERS := $(filter-out gen_*, $(wildcard *.h)) $(wildcard bitcoin/*.h)
|
||||
|
||||
CCANDIR := ccan/
|
||||
CFLAGS := -g -Wall -I $(CCANDIR) -I secp256k1/include/ -DVALGRIND_HEADERS=1 $(FEATURES)
|
||||
@ -52,6 +53,12 @@ doc/deployable-lightning.pdf: doc/deployable-lightning.lyx doc/bitcoin.bib
|
||||
doc/deployable-lightning.tex: doc/deployable-lightning.lyx
|
||||
lyx -E latex $@ $<
|
||||
|
||||
gen_version.h: FORCE
|
||||
@(echo "#define VERSION \"`git describe --always --dirty`\"" && echo "#define VERSION_NAME \"$(NAME)\"" && echo "#define BUILD_FEATURES \"$(FEATURES)\"") > $@.new
|
||||
@if cmp $@.new $@ >/dev/null 2>&2; then rm -f $@.new; else mv $@.new $@; fi
|
||||
|
||||
version.o: gen_version.h
|
||||
|
||||
update-ccan:
|
||||
mv ccan ccan.old
|
||||
DIR=$$(pwd)/ccan; cd ../ccan && ./tools/create-ccan-tree -a $$DIR `cd $$DIR.old/ccan && find * -name _info | sed s,/_info,, | sort` $(CCAN_NEW)
|
||||
@ -63,7 +70,7 @@ update-ccan:
|
||||
$(RM) -r ccan.old
|
||||
|
||||
distclean: clean
|
||||
$(RM) lightning.pb-c.c lightning.pb-c.h ccan/config.h
|
||||
$(RM) lightning.pb-c.c lightning.pb-c.h ccan/config.h gen_version.h
|
||||
$(RM) doc/deployable-lightning.pdf
|
||||
|
||||
clean:
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "bitcoin/privkey.h"
|
||||
#include "protobuf_convert.h"
|
||||
#include "funding.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -37,6 +38,7 @@ int main(int argc, char *argv[])
|
||||
"<open-channel-file1> <open-channel-file2> <open-anchor-file1> <commit-key1> [<commit-sig>]\n"
|
||||
"Check the commit sig is valid (either in open-anchor or commit-sig packet)",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "protobuf_convert.h"
|
||||
#include "gather_updates.h"
|
||||
#include "opt_bits.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -50,6 +51,7 @@ int main(int argc, char *argv[])
|
||||
opt_register_arg("--close-fee=<bits>",
|
||||
opt_set_bits, opt_show_bits, &close_fee,
|
||||
"100's of satoshi to pay for close tx");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include "opt_bits.h"
|
||||
#include "version.h"
|
||||
|
||||
/* Bitcoin nodes are allowed to be 2 hours in the future. */
|
||||
#define LOCKTIME_MIN (2 * 60 * 60)
|
||||
@ -92,6 +93,7 @@ int main(int argc, char *argv[])
|
||||
opt_register_arg("--anchor-fee=<bits>",
|
||||
opt_set_bits, opt_show_bits, &anchor_fee,
|
||||
"100's of satoshi to pay for anchor");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "protobuf_convert.h"
|
||||
#include "gather_updates.h"
|
||||
#include "funding.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -38,6 +39,7 @@ int main(int argc, char *argv[])
|
||||
"<open-channel-file1> <open-channel-file2> <open-anchor-file> <close-protobuf> <close-complete-protobuf> [update-protobuf]...\n"
|
||||
"Create the close transaction from the signatures",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "protobuf_convert.h"
|
||||
#include "test-cli/gather_updates.h"
|
||||
#include "funding.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -49,6 +50,7 @@ int main(int argc, char *argv[])
|
||||
opt_register_arg("--fee=<bits>",
|
||||
opt_set_bits, opt_show_bits, &fee,
|
||||
"100's of satoshi to pay in transaction fee");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "protobuf_convert.h"
|
||||
#include "gather_updates.h"
|
||||
#include "funding.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
/* FIXME: this code doesn't work if we're not the ones proposing the delta */
|
||||
@ -40,6 +41,7 @@ int main(int argc, char *argv[])
|
||||
"<open-channel-file1> <open-channel-file2> <open-anchor-file> <commit-privkey> [<updates>]\n"
|
||||
"Create the signature needed for the commit transaction",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "bitcoin/privkey.h"
|
||||
#include "protobuf_convert.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -48,6 +49,7 @@ int main(int argc, char *argv[])
|
||||
"Create a transaction which spends commit-tx's htlc output, and sends it P2SH to outpubkey\n"
|
||||
"It relies on timeout, unless --rvalue or --commit-preimage is specified",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "bitcoin/privkey.h"
|
||||
#include "protobuf_convert.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -37,6 +38,7 @@ int main(int argc, char *argv[])
|
||||
"<commit-tx> <revocation-preimage> <final-privkey> <open-channel-file1> <open-channel-file2> <outpubkey>\n"
|
||||
"Create a transaction which spends commit-tx's revocable output, and sends it P2SH to outpubkey",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -25,6 +26,7 @@ int main(int argc, char *argv[])
|
||||
"<open-channel-file>\n"
|
||||
"Prints anchor depth as contained in OpenChannel message",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -18,6 +18,7 @@ int main(int argc, char *argv[])
|
||||
"<open-anchor-sig-file>\n"
|
||||
"Create LeakAnchorSigsAndPretendWeDidnt to stdout",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include "opt_bits.h"
|
||||
#include "version.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -44,6 +45,7 @@ int main(int argc, char *argv[])
|
||||
"<open-channel-file1> <open-channel-file2> <anchor-tx-file> <commit-privkey1>\n"
|
||||
"A test program to output open_anchor message on stdout.",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include "opt_bits.h"
|
||||
#include "version.h"
|
||||
|
||||
/* Bitcoin nodes are allowed to be 2 hours in the future. */
|
||||
#define LOCKTIME_MIN (2 * 60 * 60)
|
||||
@ -58,6 +59,7 @@ int main(int argc, char *argv[])
|
||||
opt_register_arg("--commitment-fee=<bits>",
|
||||
opt_set_bits, opt_show_bits, &commit_tx_fee,
|
||||
"100's of satoshi to pay for commitment");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "bitcoin/privkey.h"
|
||||
#include "protobuf_convert.h"
|
||||
#include "funding.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -39,6 +40,7 @@ int main(int argc, char *argv[])
|
||||
"<open-channel-file1> <open-channel-file2> <open-anchor-file1> <commit-privkey>\n"
|
||||
"Create the signature needed for the commit transaction",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <ccan/err/err.h>
|
||||
#include "bitcoin/tx.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -22,6 +23,7 @@ int main(int argc, char *argv[])
|
||||
"<tx>\n"
|
||||
"Print txid of the transaction in the file",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "protobuf_convert.h"
|
||||
#include "gather_updates.h"
|
||||
#include "funding.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -42,6 +43,7 @@ int main(int argc, char *argv[])
|
||||
"<seed> <open-channel-file1> <open-channel-file2> <open-anchor-file> <commit-privkey> <all-updates...>\n"
|
||||
"Accept a new update message",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "protobuf_convert.h"
|
||||
#include "gather_updates.h"
|
||||
#include "funding.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -40,6 +41,7 @@ int main(int argc, char *argv[])
|
||||
"<seed> <open-channel-file1> <open-channel-file2> <open-anchor-file> <all-previous-updates>\n"
|
||||
"Create a new update-complete message",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "commit_tx.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -29,6 +30,7 @@ int main(int argc, char *argv[])
|
||||
"<seed> <update-number> <r-value>\n"
|
||||
"Create a new HTLC complete message",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include "protobuf_convert.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -31,6 +32,7 @@ int main(int argc, char *argv[])
|
||||
"<seed> <update-number> <update-pkt>\n"
|
||||
"Create a new HTLC remove message",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "commit_tx.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -32,6 +33,7 @@ int main(int argc, char *argv[])
|
||||
"<seed> <update-number> <satoshi> <r-value> <abs-locktime-seconds>\n"
|
||||
"Create a new HTLC update message",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "protobuf_convert.h"
|
||||
#include "gather_updates.h"
|
||||
#include "funding.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -42,6 +43,7 @@ int main(int argc, char *argv[])
|
||||
"<seed> <open-channel-file1> <open-channel-file2> <open-anchor-file> <commit-privkey> <all-previous-updates>...\n"
|
||||
"Create a new update-channel-signature message",
|
||||
"Print this message.");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "commit_tx.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include "version.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -37,6 +38,7 @@ int main(int argc, char *argv[])
|
||||
opt_register_arg("--from-them=<satoshi>",
|
||||
opt_set_ulonglongval_si, NULL, &from_them,
|
||||
"Amount to pay us (must use this or --to-them)");
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
|
||||
|
11
version.c
Normal file
11
version.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include "version.h"
|
||||
#include "gen_version.h"
|
||||
#include <stdio.h>
|
||||
|
||||
char *version_and_exit(const void *unused)
|
||||
{
|
||||
printf("%s\n"
|
||||
"aka. %s\n"
|
||||
"Built with: %s\n", VERSION, VERSION_NAME, BUILD_FEATURES);
|
||||
exit(0);
|
||||
}
|
11
version.h
Normal file
11
version.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef LIGHTNING_VERSION_H
|
||||
#define LIGHTNING_VERSION_H
|
||||
#include <ccan/opt/opt.h>
|
||||
|
||||
char *version_and_exit(const void *unused);
|
||||
|
||||
#define opt_register_version() \
|
||||
opt_register_noarg("--version|-V", version_and_exit, NULL, \
|
||||
"print version to standard output and exit")
|
||||
|
||||
#endif /* LIGHTNING_VERSION_H */
|
Loading…
Reference in New Issue
Block a user