Skip to content

Commit 612d713

Browse files
committed
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>
1 parent 28ea518 commit 612d713

37 files changed

+114
-107
lines changed

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ PROTOCC:=protoc-c
55

66
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
77

8-
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
8+
BITCOIN_OBJS := bitcoin/address.o bitcoin/base58.o bitcoin/pubkey.o bitcoin/script.o bitcoin/shadouble.o bitcoin/signature.o bitcoin/tx.o
9+
10+
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
911

1012
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
1113

@@ -24,15 +26,15 @@ FORCE::
2426
lightning.pb-c.c lightning.pb-c.h: lightning.proto
2527
$(PROTOCC) lightning.proto --c_out=.
2628

27-
$(PROGRAMS): % : %.o $(HELPER_OBJS) $(CCAN_OBJS)
29+
$(PROGRAMS): % : %.o $(HELPER_OBJS) $(BITCOIN_OBJS) $(CCAN_OBJS)
2830
$(PROGRAMS:=.o) $(HELPER_OBJS): $(HEADERS)
2931

3032
distclean: clean
3133
$(RM) lightning.pb-c.c lightning.pb-c.h
3234

3335
clean:
3436
$(RM) $(PROGRAMS)
35-
$(RM) *.o $(CCAN_OBJS)
37+
$(RM) bitcoin/*.o *.o $(CCAN_OBJS)
3638

3739
ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c
3840
$(CC) $(CFLAGS) -c -o $@ $<

anchor.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include "anchor.h"
2-
#include "bitcoin_tx.h"
2+
#include "bitcoin/tx.h"
33
#include "overflows.h"
44
#include "pkt.h"
55
#include "permute_tx.h"
6-
#include "bitcoin_script.h"
7-
#include "pubkey.h"
6+
#include "bitcoin/script.h"
7+
#include "bitcoin/pubkey.h"
88
#include <ccan/err/err.h>
99

1010
struct bitcoin_tx *anchor_tx_create(const tal_t *ctx,

bitcoin/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
These are standard bitcoin manipulation routines which should be
2+
provided by any normal bitcoin library in whatever language you choose.
3+
4+
The ones here are standalone ones taken from bitcoin core and soe I
5+
wrote, many taken from bitcoin-iterate and pasted in here.
6+

bitcoin_address.c renamed to bitcoin/address.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "bitcoin_address.h"
1+
#include "address.h"
22
#include "pubkey.h"
33
#include <ccan/crypto/sha256/sha256.h>
44

File renamed without changes.

base58.c renamed to bitcoin/base58.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
66
#include "base58.h"
77
#include "shadouble.h"
8-
#include "bitcoin_address.h"
8+
#include "address.h"
99
#include "pubkey.h"
1010
#include <assert.h>
1111
#include <ccan/build_assert/build_assert.h>

base58.h renamed to bitcoin/base58.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef LIGHTNING_BASE58_H
2-
#define LIGHTNING_BASE58_H
1+
#ifndef LIGHTNING_BITCOIN_BASE58_H
2+
#define LIGHTNING_BITCOIN_BASE58_H
33
/* FIXME: Use libsecpk1 */
44
#include <ccan/tal/tal.h>
55
#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);
4444
bool raw_decode_base58(BIGNUM *bn, const char *src, size_t len);
4545
void base58_get_checksum(u8 csum[4], const u8 buf[], size_t buflen);
4646

47-
#endif /* PETTYCOIN_BASE58_H */
47+
#endif /* PETTYCOIN_BITCOIN_BASE58_H */
File renamed without changes.

pubkey.h renamed to bitcoin/pubkey.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#ifndef LIGHTNING_PUBKEY_H
2-
#define LIGHTNING_PUBKEY_H
1+
#ifndef LIGHTNING_BITCOIN_PUBKEY_H
2+
#define LIGHTNING_BITCOIN_PUBKEY_H
33
#include <ccan/short_types/short_types.h>
44
#include <ccan/tal/tal.h>
5-
#include "lightning.pb-c.h"
5+
#include "../lightning.pb-c.h"
66

77
struct pubkey {
88
u8 key[65];

bitcoin_script.c renamed to bitcoin/script.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "bitcoin_script.h"
2-
#include "bitcoin_address.h"
3-
#include "pkt.h"
1+
#include "script.h"
2+
#include "address.h"
43
#include "signature.h"
54
#include "pubkey.h"
65
#include <openssl/ripemd.h>

0 commit comments

Comments
 (0)