Commit Graph

12 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
d85719b5a7
lnwallet: add elkrem root derivation function
The derivation is current bed on an HKDF invocation using our private
key as the secret, and the node’s channel multi-sig key as the salt.
This scheme allows us to derive the key on the fly given data known to
only us and the remote node.

The current derivation is just a place-holder and will be re-visited at
a later time.
2016-06-30 12:09:42 -07:00
Olaoluwa Osuntokun
e22734f9cf
lnwallet: update HTLC+commitment scripts
This commit updates the previous HTLC and commitment scripts to their
current latest evolution.

The HTLC scripts have been optimized for space savings, the
functionality itself has remained relatively unchanged. A trade off was
made to add additional bytes into the sigScript in order to avoid
extraneous CHECKSIG’s. The rationale is that an extra 1-2 bytes in the
sigScript to guide execution, are worthwhile since they’re in the
witness, and witness data may be pruned in the near future.

The primary change is within the commitment transaction itself. Instead
of using revocation hashes, we now use signature based revocation. This
saves space in the Script, and optimizes away an extra hashing
operation. Elkrem/shachain is still used but, we now use the pre-images
to homomorphically derive a public key which the other party will be
able to sign with, once we disclose the pre-image itself.

Finally, we have switched to using SHA-256 everywhere uniformly for
both revocation hashes, and payment hashes. The rationale is that the
output of ripemd160 is too small for modern security margins, and that
other coins/chains are more likely to have SHA-256 implemented, than
ripemd160.

A set of tests has also been included which contain (mostly) exhaustive
tests of all possible redemption paths for both commitment and HTLC.
2016-06-27 11:35:32 -07:00
Olaoluwa Osuntokun
fcff17c336
multi: change all imports to roasbeef's forks
This commit will allow the general public to build lnd without jumping
through hoops setting up their local git branches nicely with all of
our forks.
2016-05-15 17:22:37 +03:00
Olaoluwa Osuntokun
eeb2887fe9
lnwallet: segwit-ify all scripts and signing utils 2016-05-03 20:06:39 -07:00
Olaoluwa Osuntokun
81a4887d11 lnwallet: move lockTimeToSequence to script_utils.go 2016-02-05 20:24:17 -08:00
Olaoluwa Osuntokun
fa05ee9a22 lnwallet: move pubKey comparison for funding output spend into spendMultiSig func
* This change makes the spendMultiSig function testable independent of
the reservation workflow.
2016-02-05 12:33:22 -08:00
Olaoluwa Osuntokun
d96cf0ec64 lnwallet: fix receiver htlc script
* Fixes a bug in script_utils.go. CSV instead of CLTV was being used
  within the timeout clause of the receivers HTLC (sender can reclaim
the HTLC).
2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
7ec419bde5 lnwallet: add docstrings to script_utils.go 2016-01-14 23:56:10 -08:00
Olaoluwa Osuntokun
41f4992218 lnwallet: add utils to generate HTLC scripts, split up commit output scripts 2016-01-14 23:56:08 -08:00
Olaoluwa Osuntokun
1c4887e746 lnwallet: drop some comments upon script_utils.go 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
d3fe04ab9b lnwallet: add function to locate script index to script_utils.go 2015-12-20 21:47:29 -06:00
Olaoluwa Osuntokun
30523d7db3 lnwallet: import badge's script utils in new file 2015-12-20 17:10:24 -06:00