Rusty Russell
888389e625
ccan: update and add more.
We need the following additional modules for the daemon:
io, time, timer, pipecmd
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
906a5e4a32
Move pkt.c into test-cli.
We use cryptopkt for normal cases.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
a38d0c985e
Makefile: more fascist warnings.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4163935bbb
ccan: import time module.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
e97e8988f8
ccan: import isaac and dependencies.
We could probably just use Openssl's RAND_pseudo_bytes, but this gives
a nice interface to get a number between 1 and N.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4795a4d46f
Makefile: sanity check source and makefile
This enforces the include order implemented by the previous patch, and
also make sure we haven't missed any headers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4dafeba857
Makefile: depend on headers.
A halfway house between the horror of dynamic generation and the fail of
making everything depend on every header.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
ffe20fb2ae
bitcoin: add OP_CHECKLOCKTIMEVERIFY support (BIP65)
No need to use noops now that BIP65 is active.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
aeedafc20f
Switch to bitcoind by default.
I haven't implemented getting transactions from alphad (it needs the values
for the inputs, too), so switch to bitcoind.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4b02c6f558
locktime: nice abstractions for absolute and relative locktimes.
I got confused navigating these, especially since Alpha and Bitcoin
have diverged (BIP68 was proposed after Elements Alpha).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
6b2d844f2a
bitcoin: use ccan/mem instead of rolling own check_mem function.
Reported-by: John Newbery
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Anthony Towns
b66852f1ab
Makefile: add python onion tests
9 years ago
Anthony Towns
2042e1cdb7
onion_key: generate multiple keys at once
9 years ago
Rusty Russell
ed46dd355d
test_onion: split encode and decode, drive from cmdline.
This lets us test interaction with python code, for example.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
32a08ce6c5
test/onion_key: helper to generate deterministic key pairs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
f36ba8f8e1
Makefile: only erase protobuf and PDF files with maintainer-clean.
Reported-by: Anthony Towns
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
81d35294f4
test/test_onion: demo program to show onion routing crypto.
We can make this more efficient, but this works for now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
e7856e6e69
Update libsecp to git@github.com:bitcoin/secp256k1.git 52fd03f
We want the ecdh stuff for onion routing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
17f457568a
Makefile: generate libsecpk1 properly.
And clean it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
454a3867e5
BIP68 support (nSequence enforcement)
The latest version of the BIP doesn't use inversion, but does use
bitshifts.
It also uncovered a bug in the test scripts: the block timestamps
creep forward when we generate large numbers of blocks (UpdateTime
insists it be > GetMedianTimePast() so it's valid). We need to take
this into account when waiting for the median to move (reduced it from
60 to 30 seconds, since that adds about 14 seconds).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
845d09ce68
check: simple Makefile target.
This makes it much easier to run all the test scripts.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
786bef9002
test/test_state_coverage: output dot format.
Good for documentation, plus impressive with all the error states...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
1556315f2e
test_state_coverage: simple exhaustive coverage test for state machine.
Makes sure that we visit every state.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
5730b118f1
Some more ccan objs.
These are LGPL, but only used for tests.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
669479b671
gen_state_names.h: printable names for state_types enums.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
8af4619406
Makefile: neaten
Reduces gratuitous patch conflicts in future.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
1cb147c5b8
Version number, name, and build details.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
fcbba0280d
test-cli/create-htlc-spend-tx: new util.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
b5ff69e236
test-cli/update-channel-htlc-remove: new util.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
9b0ed51f2b
test-cli/update-channel-htlc-complete: new util.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
5778b004dd
test-cli/update-channel-htlc: new util.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
cf3433a0ad
script: add OP_CHECKLOCKTIMEVERIFY.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
eac3af06f1
protocol: switch to single-funder anchor model.
Most complex change was gather_updates(), which handles all the "what
is the current state of the channel" logic for our dumb test utils.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
f78ea05fc5
test-cli/extract-escape-secret: helper to get escape secret from other side.
When other side uses their escape tx, we extract the secret to we
can use our fast-escape.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
7564e3f475
test-cli/create-secret-spend-tx: more general tool to spend secret-or-delay outputs
Immediately replaces create-commit-spend-tx and create-steal-tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
402cd67e10
test-cli/extract-revocation-preimage: helper to get preimage from message
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
2e36affb77
test-cli/get-revocation-secret: new helper.
Give the revocation secret (or hash) for a given index number.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
ebb068e975
Escape transaction support, test tools to create/check them.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
ee3af28980
test-cli/txid-of: simple helper to get txid.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
98d994f930
protocol: add open-complete.
This is where we expose the revocation preimages for the escape
transactions.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
c03c878afc
Split into two anchors.
This is a major change; instead of creating a mutual anchor (funding)
transaction, each side creates its own. We use escape transactions in
case anything goes wrong; these will be revoked later.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
bde07aa6a7
Makefile: fix make clean, depend on bitcoin/ headers.
Didn't remove program object files, nor depend on all headers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
e4921b9bc6
Add documentation.
First up, a draft of a paper showing the differences between the LN draft
and this.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
8f64eb90af
Switch over to CCAN's ripemd160.
Avoids handing naked u8 arrays around, too.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
ec399e13a4
Makefile: update-ccan: new target.
Hacky, but syncs up ccan repository.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
a663dc322c
Remove signature leaking.
Alpha has segregated witnesses, so txid doesn't include the inputs.
That means we can create the first commit transaction before we sign
the anchor tx.
Bitcoin will need to do this differently: presumbly via new sipops
(a OP_CHECKSIG2VERIFY I imagine).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
f510e29e22
alpha: switch over to Elements Alpha by default.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
62a002c860
script: make DER for signature encoding optional.
Alpha does the sane thing, places signatures raw.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
faae91f3fc
Schnorr signature support.
This variation is used by alpha.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
d20ddb5a90
Use libsecp256k1 instead of openssl for crypto.
We still use openssl for bignums (base58) and for ripemd.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago