mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 10:46:58 +01:00
Move bitcoin stuff into bitcoin subdir.
It's not very interesting if you're looking for LN code. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
28ea518182
commit
612d713470
37 changed files with 114 additions and 107 deletions
8
Makefile
8
Makefile
|
@ -5,7 +5,9 @@ PROTOCC:=protoc-c
|
|||
|
||||
PROGRAMS := open-channel open-anchor-scriptsigs leak-anchor-sigs open-commit-sig check-commit-sig check-anchor-scriptsigs get-anchor-depth create-steal-tx create-commit-spend-tx close-channel create-close-tx update-channel update-channel-accept update-channel-signature update-channel-complete create-commit-tx
|
||||
|
||||
HELPER_OBJS := base58.o lightning.pb-c.o shadouble.o pkt.o bitcoin_script.o permute_tx.o signature.o bitcoin_tx.o bitcoin_address.o anchor.o commit_tx.o pubkey.o opt_bits.o close_tx.o find_p2sh_out.o
|
||||
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 anchor.o commit_tx.o opt_bits.o close_tx.o find_p2sh_out.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
|
||||
|
||||
|
@ -24,7 +26,7 @@ FORCE::
|
|||
lightning.pb-c.c lightning.pb-c.h: lightning.proto
|
||||
$(PROTOCC) lightning.proto --c_out=.
|
||||
|
||||
$(PROGRAMS): % : %.o $(HELPER_OBJS) $(CCAN_OBJS)
|
||||
$(PROGRAMS): % : %.o $(HELPER_OBJS) $(BITCOIN_OBJS) $(CCAN_OBJS)
|
||||
$(PROGRAMS:=.o) $(HELPER_OBJS): $(HEADERS)
|
||||
|
||||
distclean: clean
|
||||
|
@ -32,7 +34,7 @@ distclean: clean
|
|||
|
||||
clean:
|
||||
$(RM) $(PROGRAMS)
|
||||
$(RM) *.o $(CCAN_OBJS)
|
||||
$(RM) bitcoin/*.o *.o $(CCAN_OBJS)
|
||||
|
||||
ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
|
6
anchor.c
6
anchor.c
|
@ -1,10 +1,10 @@
|
|||
#include "anchor.h"
|
||||
#include "bitcoin_tx.h"
|
||||
#include "bitcoin/tx.h"
|
||||
#include "overflows.h"
|
||||
#include "pkt.h"
|
||||
#include "permute_tx.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include <ccan/err/err.h>
|
||||
|
||||
struct bitcoin_tx *anchor_tx_create(const tal_t *ctx,
|
||||
|
|
6
bitcoin/README
Normal file
6
bitcoin/README
Normal file
|
@ -0,0 +1,6 @@
|
|||
These are standard bitcoin manipulation routines which should be
|
||||
provided by any normal bitcoin library in whatever language you choose.
|
||||
|
||||
The ones here are standalone ones taken from bitcoin core and soe I
|
||||
wrote, many taken from bitcoin-iterate and pasted in here.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "bitcoin_address.h"
|
||||
#include "address.h"
|
||||
#include "pubkey.h"
|
||||
#include <ccan/crypto/sha256/sha256.h>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#include "base58.h"
|
||||
#include "shadouble.h"
|
||||
#include "bitcoin_address.h"
|
||||
#include "address.h"
|
||||
#include "pubkey.h"
|
||||
#include <assert.h>
|
||||
#include <ccan/build_assert/build_assert.h>
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef LIGHTNING_BASE58_H
|
||||
#define LIGHTNING_BASE58_H
|
||||
#ifndef LIGHTNING_BITCOIN_BASE58_H
|
||||
#define LIGHTNING_BITCOIN_BASE58_H
|
||||
/* FIXME: Use libsecpk1 */
|
||||
#include <ccan/tal/tal.h>
|
||||
#include <ccan/short_types/short_types.h>
|
||||
|
@ -44,4 +44,4 @@ bool raw_decode_base_n(BIGNUM *bn, const char *src, size_t len, int base);
|
|||
bool raw_decode_base58(BIGNUM *bn, const char *src, size_t len);
|
||||
void base58_get_checksum(u8 csum[4], const u8 buf[], size_t buflen);
|
||||
|
||||
#endif /* PETTYCOIN_BASE58_H */
|
||||
#endif /* PETTYCOIN_BITCOIN_BASE58_H */
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef LIGHTNING_PUBKEY_H
|
||||
#define LIGHTNING_PUBKEY_H
|
||||
#ifndef LIGHTNING_BITCOIN_PUBKEY_H
|
||||
#define LIGHTNING_BITCOIN_PUBKEY_H
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "../lightning.pb-c.h"
|
||||
|
||||
struct pubkey {
|
||||
u8 key[65];
|
|
@ -1,6 +1,5 @@
|
|||
#include "bitcoin_script.h"
|
||||
#include "bitcoin_address.h"
|
||||
#include "pkt.h"
|
||||
#include "script.h"
|
||||
#include "address.h"
|
||||
#include "signature.h"
|
||||
#include "pubkey.h"
|
||||
#include <openssl/ripemd.h>
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef LIGHTNING_SHADOUBLE_H
|
||||
#define LIGHTNING_SHADOUBLE_H
|
||||
#ifndef LIGHTNING_BITCOIN_SHADOUBLE_H
|
||||
#define LIGHTNING_BITCOIN_SHADOUBLE_H
|
||||
#include "config.h"
|
||||
#include <ccan/crypto/sha256/sha256.h>
|
||||
|
||||
|
@ -11,4 +11,4 @@ struct sha256_double {
|
|||
void sha256_double(struct sha256_double *shadouble, const void *p, size_t len);
|
||||
|
||||
void sha256_double_done(struct sha256_ctx *sha256, struct sha256_double *res);
|
||||
#endif /* PETTYCOIN_SHADOUBLE_H */
|
||||
#endif /* LIGHTNING_BITCOIN_SHADOUBLE_H */
|
|
@ -1,8 +1,8 @@
|
|||
#include "signature.h"
|
||||
#include "shadouble.h"
|
||||
#include "bitcoin_tx.h"
|
||||
#include "tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "script.h"
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <assert.h>
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef LIGHTNING_SIGNATURE_H
|
||||
#define LIGHTNING_SIGNATURE_H
|
||||
#ifndef LIGHTNING_BITCOIN_SIGNATURE_H
|
||||
#define LIGHTNING_BITCOIN_SIGNATURE_H
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "../lightning.pb-c.h"
|
||||
|
||||
enum sighash_type {
|
||||
SIGHASH_ALL = 1,
|
||||
|
@ -51,4 +51,4 @@ bool check_2of2_sig(struct bitcoin_tx *tx, size_t input_num,
|
|||
Signature *signature_to_proto(const tal_t *ctx, const struct signature *sig);
|
||||
bool proto_to_signature(const Signature *pb, struct signature *sig);
|
||||
|
||||
#endif /* LIGHTNING_SIGNATURE_H */
|
||||
#endif /* LIGHTNING_BITCOIN_SIGNATURE_H */
|
|
@ -1,4 +1,4 @@
|
|||
#include "bitcoin_tx.h"
|
||||
#include "tx.h"
|
||||
#include <ccan/crypto/sha256/sha256.h>
|
||||
#include <ccan/err/err.h>
|
||||
#include <ccan/tal/grab_file/grab_file.h>
|
|
@ -12,13 +12,13 @@
|
|||
#include <ccan/structeq/structeq.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "close_tx.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include <openssl/ec.h>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "close_tx.h"
|
||||
#include "shadouble.h"
|
||||
#include "bitcoin_tx.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/shadouble.h"
|
||||
#include "bitcoin/tx.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "pkt.h"
|
||||
|
||||
struct bitcoin_tx *create_close_tx(const tal_t *ctx,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "commit_tx.h"
|
||||
#include "shadouble.h"
|
||||
#include "bitcoin_tx.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/shadouble.h"
|
||||
#include "bitcoin/tx.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "pkt.h"
|
||||
|
||||
struct bitcoin_tx *create_commit_tx(const tal_t *ctx,
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "close_tx.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include <openssl/ec.h>
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
#include <ccan/structeq/structeq.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin_address.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "bitcoin/address.h"
|
||||
#include "opt_bits.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include <openssl/ec.h>
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "find_p2sh_out.h"
|
||||
#include "bitcoin_tx.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/tx.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include <string.h>
|
||||
#include <ccan/err/err.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
#include <ccan/err/err.h>
|
||||
#include <ccan/opt/opt.h>
|
||||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "bitcoin_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/tx.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "lightning.pb-c.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin_address.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "bitcoin/address.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "anchor.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include <ccan/err/err.h>
|
||||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin_address.h"
|
||||
#include "bitcoin_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "shadouble.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "bitcoin/address.h"
|
||||
#include "bitcoin/tx.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "bitcoin/shadouble.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
#include "opt_bits.h"
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef LIGHTNING_PERMUTE_TX_H
|
||||
#define LIGHTNING_PERMUTE_TX_H
|
||||
#include "bitcoin_tx.h"
|
||||
#include "bitcoin/tx.h"
|
||||
|
||||
/* Given the two seeds, permute the transaction inputs.
|
||||
* map[0] is set to the new index of input 0, etc.
|
||||
|
|
8
pkt.c
8
pkt.c
|
@ -2,10 +2,10 @@
|
|||
#include <ccan/tal/grab_file/grab_file.h>
|
||||
#include <ccan/err/err.h>
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_tx.h"
|
||||
#include "bitcoin_address.h"
|
||||
#include "pubkey.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/tx.h"
|
||||
#include "bitcoin/address.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "bitcoin/signature.h"
|
||||
|
||||
#include <stdio.h>
|
||||
static struct pkt *to_pkt(const tal_t *ctx, Pkt__PktCase type, void *msg)
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include <ccan/structeq/structeq.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include "lightning.pb-c.h"
|
||||
#include "anchor.h"
|
||||
#include "base58.h"
|
||||
#include "bitcoin/base58.h"
|
||||
#include "pkt.h"
|
||||
#include "bitcoin_script.h"
|
||||
#include "bitcoin/script.h"
|
||||
#include "permute_tx.h"
|
||||
#include "signature.h"
|
||||
#include "bitcoin/signature.h"
|
||||
#include "commit_tx.h"
|
||||
#include "pubkey.h"
|
||||
#include "bitcoin/pubkey.h"
|
||||
#include "find_p2sh_out.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <unistd.h>
|
||||
|
|
Loading…
Add table
Reference in a new issue