Rusty Russell
92ec2f874b
pkt: add pkt_totlen() helper.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-12 13:06:33 +09:30
Rusty Russell
6389dbd455
protocol: restore locktime in blocks option.
...
This could be used by an always-on node to agressively shorten their timeouts.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-12 13:06:33 +09:30
Rusty Russell
ef9463f6b1
Sort include lines (ignoring hacky cli test utils).
...
Put ccan first, openssl next, then standard headers, then locals.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-12 12:41:28 +09:30
Rusty Russell
442f321585
Move protobuf<->bitcoin converters out of bitcoin/
...
They're lightning-specific.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-12 12:35:42 +09:30
Rusty Russell
612d713470
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>
2015-06-12 12:35:42 +09:30
Rusty Russell
ed3f0115d6
protocol: fix horribly thinko, keep own secrets.
...
I had each side using the other side's hash secret. That's a very
dumb idea, since it means you can steal from a unilateral close!
A's secret applies to A's commit transaction: it needs the
secret and B's final signature to steal funds, and that should
never happen (since A doesn't have the B's final signature, and
once A has given B the secret, they never broadcast the commit tx).
This makes the update a 4 step dance, since you need the new
revocation hash to make the other side's TX to sign.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-10 21:39:45 +09:30
Rusty Russell
3fef1584e5
update-channel-complete: final step in channel update.
...
(note: I didn't bother writing the code to check the sig on this).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-09 14:13:27 +09:30
Rusty Russell
3957f1e1c1
update-channel-accept: accept the channel update.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-09 14:13:27 +09:30
Rusty Russell
d51f6372aa
update-channel: prepare a new tx with modified amounts.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-09 14:13:27 +09:30
Rusty Russell
c6ed5926cb
close-channel: add --complete option.
...
Code is identical, so don't create separate close-channel-complete binary.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-08 14:54:02 +09:30
Rusty Russell
38f7a23064
close-channel: create message to mutually close channel.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-08 14:46:41 +09:30
Rusty Russell
4dd6b8e385
lightning.proto: Rename 'to_me' to 'final', use for commit_tx.
...
This is where the commit tx outputs should pay to.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-08 06:29:15 +09:30
Rusty Russell
29d0cdc3cd
open-channel: use pubkey, not arbitrary script for final outout address.
...
We need to pay to this from two places: on their side, it's a simple
payment, on our side, it's a complex timeout-or-mutual-or-hval script,
which doesn't lend itself to arbitrary scripts.
Use P2SH, of course.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-05 11:37:27 +09:30
Rusty Russell
67f98fe6b6
Rename "anchor sig" to "anchor scriptsigs" to be clearer.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-04 12:10:01 +09:30
Rusty Russell
07c7214edb
Explicit pubkey structure.
...
This checks that the protobuf is the right form, also handles uncompressed
keys (though you shouldn't be using those any more, should you?)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-02 11:53:59 +09:30
Rusty Russell
7c977a7633
Move signature <-> proto conversions to signature.c, check lower bit.
...
Make sure signature can be used by bitcoin.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-01 14:24:18 +09:30
Rusty Russell
eec612af9f
Use raw 64-byte signatures in protocol.
...
DER encoding introduces problems for non-canonical encodings; we should
do that only at the lightning<->bitcoin interface.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-01 13:04:00 +09:30
Rusty Russell
bf38ca052e
open-commit-sig: create signature for commit tx.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-30 20:12:14 +09:30
Rusty Russell
8d31902785
Remove locktime-in-blocks option.
...
Needless complexity, AFAICT.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-30 20:12:14 +09:30
Rusty Russell
10133575b9
leak-anchor-sigs: the horrible hack until we have normalized txs.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-30 20:12:14 +09:30
Rusty Russell
670670f138
open-anchor-sig, many fixes for open-channel.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-29 10:51:16 +09:30
Rusty Russell
94254e7c3f
open_channel: say what version txs we'll create.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-27 11:42:05 +09:30
Rusty Russell
1c4fdce514
Initial silly cmdline util to create an openchannel packet.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-26 14:08:38 +09:30