Commit Graph

23 Commits

Author SHA1 Message Date
Conner Fromknecht
ac2e1d7d96
watchtower/blob/justice_kit: conditional anchor to-remote script
This commit modifies the ToRemoteWitnessScript function to be
conditioned on the blob type, and return either the legacy or anchor
to-remote script. The same witness satisfies either script, so no
changes are necessary to ToRemoteWitnessStack.
2020-09-15 12:43:44 -04:00
Conner Fromknecht
ffe15e2820
watchtower/blob/justice_kit: add BlobType to JusticeKit struct
This is preparation for later commits where the values returned by
member methods will need to be conditioned on the blob type used during
decryption.
2020-09-15 12:43:37 -04:00
Conner Fromknecht
b82695dbcc
watchtower/blob/justice_kit_test: convert to require
This is also a prepatory step to making
TestJusticeKitRemoteWitnessConstruction parameteried by the blob type so
we can test both anchor and legacy witness construction.
2020-09-15 12:43:26 -04:00
Conner Fromknecht
0477c80732
watchtower/blob/type: add new FlagAnchorChannel 2020-09-15 12:43:20 -04:00
Conner Fromknecht
ed67ce7678
watchtower/blob/type: remove use of iota for flag constants 2020-09-15 12:43:06 -04:00
Conner Fromknecht
a246d8216a
watchtower/multi: define blob TypeAltruistCommit and TypeRewardCommit 2019-06-13 19:54:21 -07:00
Conner Fromknecht
3b51906a78
watchtower/multi: use new blob.BreachKey for enc/dec of justice kits 2019-06-13 19:54:17 -07:00
Conner Fromknecht
59bf4857f4
watchtower/blob/breach_key: define breach key as sha(txid || txid) 2019-06-13 19:33:16 -07:00
Conner Fromknecht
d9cfa610dc
watchtower/wtdb/breach_hint: redefine breach hint as sha(txid) 2019-06-13 19:33:16 -07:00
Conner Fromknecht
1b89ba1782
watchtower/multi: move BreachHint to blob pkg 2019-06-13 17:40:04 -07:00
Joost Jager
9e012ecc93
multi: move Input interface and related code
This commit is a step to split the lnwallet package. It puts the Input
interface and implementations in a separate package along with all their
dependencies from lnwallet.
2019-01-31 13:25:33 +01:00
Conner Fromknecht
f66e713b35
watchtower/blob/justice_kit_test: test witness script/stack construction 2019-01-10 15:59:54 -08:00
Conner Fromknecht
b746bf86c2
watchtower/multi: switch over to wtpolicy
migrate to using wtpolicy.Policy in wtwire messages and wtserver
2019-01-10 15:59:54 -08:00
Conner Fromknecht
cf1b8ba78f
watchtower/blob/type_test: adds Flag and Type unit tests 2019-01-10 15:59:54 -08:00
Conner Fromknecht
bc09c6dbae
watchtower/blob/type: introduces blob type flags
Adds flags for reward outputs and commitment outputs.
The fixed-size encoding for commitment outputs is
treated as a flag, so that the blob format can be
modified, extended, or replaced in future iterations.
2019-01-10 15:35:07 -08:00
Conner Fromknecht
740e8fd686
watchtower/blob/justice_kit_test: remove external nonce
The nonce is now passed in as the prefix to the
ciphertext, and is generated randomly in calls
to Encrypt.
2018-10-31 20:42:03 -07:00
Conner Fromknecht
c5eba3b608
watchtower/blob/justice_kit: use randomized 192-bit nonce
This commit modifies the blob encryption scheme to
use chacha20-poly1305 with a randomized 192-bit nonce.
The previous approach used a deterministic nonce scheme,
which is being replaced to simplify the requirements of
a correct implementation.  As a result, each payload
gains an addtional 24-bytes prepended to the ciphertext.
2018-10-31 20:42:01 -07:00
Conner Fromknecht
2dd399ca52
watchtower/blob/justice_kit: return DER signatures
This commit fixes an issue with the witness stack
construction for to-local and to-remote inputs,
that would cause the justice kit to return
signatures as fixed-size, 64-byte signatures.
The correct behavior is to return DER-encoded
signatures so that they will properly verify on
the network, since the consensus rules won't
be able to understand the fixed-size variant.
2018-10-31 17:36:18 -07:00
Conner Fromknecht
2255ce17db
watchtower/blob/justice_kit_test: add sweep addr tests
Adds vectors to the justice kit tests to
ensure variable length sweep addresses are
properly encoded/decoded.
2018-10-29 16:48:43 -07:00
Conner Fromknecht
b7d811b3dd
watchtower/blob/justice_kit: add variable length sweep addr
This commit fixes an oversight in the previous
design of the watchtower blob, by introducing
a length byte for sweep addresses. The previous
format supposed that addresses would be padded
to 42 bytes, but had no indication of the
address's actual length.

To rememdy this, we introduce a single byte
indicating the actual size of the address,
such that the padding can be removed upon
decoding.
2018-10-29 16:48:43 -07:00
Conner Fromknecht
ae6f06155a
watchtower/blob/justice_kit_test: use test.Run for sub tests 2018-10-29 16:34:31 -07:00
Conner Fromknecht
085e1f9ca8
watchtower/blob/justice_kit_test: add encrypt/decrypt test vectors 2018-07-24 19:55:07 -07:00
Conner Fromknecht
9749096403
watchtower/blob/justice_kit: adds v0 encoding and encryption 2018-07-24 19:55:07 -07:00