Commit Graph

525 Commits

Author SHA1 Message Date
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
ecb39efed1 find_p2sh_out: extract helper.
Really only for our silly little utils.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-09 14:13:21 +09:30
Rusty Russell
7175d73573 create-close-tx: create a mutual close tx from the close sigs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-08 15:08:10 +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
16baa1dae9 create-commit-spend-tx: spend the commit tx (after timeout)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-08 09:29:09 +09:30
Rusty Russell
fc8552318a opt_bits: parsing routines for 'bits' == 100 satoshi.
Also fix open-channel usage message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-07 13:52:04 +09:30
Rusty Russell
126192a842 create-steal-tx: get my money back!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-05 17:22:54 +09:30
Rusty Russell
0742e5356f get-anchor-depth: simple helper to get min_confirms from OpenChannel packet
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-05 11:09:29 +09:30
Rusty Russell
33bbd38691 Makefile: cleanup and generalize
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-05 11:05:05 +09:30
Rusty Russell
623c6562af Makefile: add TAGS target.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-04 15:46:39 +09:30
Rusty Russell
617d21eb43 check-anchor-scriptsigs: dump out anchor tx if scriptsigs make expected tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-04 14:15:51 +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
c291d19af6 Add check-commit-sig.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-02 14:28:59 +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
c04d20e019 commit_tx: new file containing logic to create initial commitment transaction.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-30 20:44: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
63986e5b2d Rename perturb to permute.
Perturb is a bit stretched for this, permute is better.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-30 20:12:14 +09:30
Rusty Russell
f43cdf085a Move anchor creation out into its own file.
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
81ac81e699 Rename openchannel to open-channel.
Since I'm about to write create-anchor, which definitely needs a separator.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-26 14:14:19 +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