Rusty Russell
847ef21c07
state: Core state machine for lightning.
It's written in a repetitive and stylized form, for easier testing.
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
1fca363b31
state_types: types for state machine.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
1b2de5c830
CCAN: add cdump.
Used to print enums.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
3b0aca81f5
CCAN: update.
Trivial updae.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
f0cab4e74b
gather_updates: fix rebase error.
Didn't update amount field in d00eeded9f
.
Didn't compile test either :(
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
02a563ba82
protocol: renumber.
Use lower numbers and clean up.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
fefe2deea2
protocol: add a third leg to the close operation.
This gives us a neat way to know the other end has received our sig.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
d00eeded9f
protocol: split message update_remove_htlc into update_timedout_htlc and update_routefail_htlc, remove update_remove_htlc_delay.
For the moment, there's no way to remove an in-progress HTLC before
it's timed out. The other side can remove it with a routefail, but
you can't push for it to be removed.
We may add that later, but by definition it's only a polited request, and
normally we should rely on timeouts.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
807ac38308
protocol: add decline response for HTLC.
We don't have to accept an HTLC they offer; we might not be able to
route it, or it might offer insufficient payment.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
5bc22f0368
protocol: increase HTLC precision to 1/1000 satoshi.
This gets truncated for on-chain transactions (thus, rounding may
contribute to fees).
This also means we currently have an upper bound of 0.04 BTC per HTLC;
this can be increased later if required.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
58a62e782d
bitcoin/script: don't pass value for HTLC script.
We don't need it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
186736050f
test-cli: fix alpha case.
The output of grep confuses the scripts.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
bc056fbc4d
doc/deployable-lightning: point out that Fig 4 is simplified.
Fixes #4
Reported-by: Pierre <pm+lists@acinq.fr>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
71c56e0360
doc: biblopgraphy update
Thanks to Anthony Towns for digging this up.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
17471d0788
Merge pull request #3 from pm47/master
explicitely specified proto version
9 years ago
pm47
d97c68717b
explicitely specified proto version
9 years ago
Rusty Russell
785b061034
Merge branch 'pm47-master'
9 years ago
pm47
a97d390128
fixed typos in pdf
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
6883d28f6d
doc: move dual anchor with escapes to Appendix B.
Draft 0.2; we use a single-sided anchor now, for simplicity.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
3311580c62
scripts/test.sh: fix bitcoin case.
Now we use locktime, bitcoin needs delay too.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
0b33da08c1
scripts: auto-detect alpha vs bitcoin
A bit hacky, but saves editing two places.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
6cea21750d
HOWTO-USE.md: Just refer to test scripts.
This has fallen behind.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
3b214479ae
test-cli/scripts/test.sh: basic HTLC spending test.
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
bafc93886f
test-cli/scripts/test.sh: basic HTLC creation test.
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
7ed0b461aa
commit_tx: add HTLCs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
106c447d17
gather_updates: handle HTLC updates.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
769f9f1cc5
gather_updates: extract some update logic into update_rhash.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
f0df2b7930
channel_state: add htlcs array.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
a09c0a9fa7
funding: take into account HTLC add/remove.
Enhance funding_delta() to have an HTLC delta as well as an A->B delta.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
88ca0c91d9
doc: document HTLC 2drop optimization.
We can save an opcode in both HTLC send and receive scripts by using
OP_2DROP instead of OP_DROP twice.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
08ae4a687d
script: HTLC support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
9a0163ec85
proto_to_locktime: abs and relative locktime handlers.
Our current proto_to_locktime actually handles relative locktimes,
and HTLCs use absolute. Fix that.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
7f21695a63
protocol: rename locktime fields to "delay" and "expiry"
For open transactions, locktime is a delay we require on the other
side's to-self commit transaction outputs to ensure we can cut them
off if necessary.
For HTLCs, it's an absolute expiry time.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
3325c7320d
protocol: add HTLC
Proposing an HTLC follows the same sequence as proposing a normal
update. There's also requests to complete and remove HTLCs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
a4dfe3ad72
channel_state: encapsulate funding of channel in one place.
This shows where funds are going at any time (fees vs to each side).
funding.c is mainly rewritten, and should be clearer now.
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
0170ad4abd
script: add add_push_le32 helper.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
81bced330a
protocol: move locktime into its own message type.
We're going to want this for HTLC times, too.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
d9f2b37a05
commit_tx: remove to_me weirdness.
It's a synonym for theirkey.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
142e822342
test-cli/update-channel-signature: remove debugging message.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
e489ff80c0
commit_tx: remove debugging printf.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
a0fc4f8a79
Update .gitignore.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
b72ab56312
test-cli/open-anchor.c: add missing file.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago