Commit Graph

11 Commits

Author SHA1 Message Date
Conner Fromknecht
c1b9b272cd
input/size: assert witness size constants
This commit introduces a new test case that asserts all of the witness
size constants currently in the codebase. We also reintroduce the
AcceptedHtlcSuccessWitnessSize and OfferedHtlcTimeoutWitnessSize
constants that were recently removed for the sake of completeness.

In asserting the witnes sizes, there were three uncovered discrepancies:
 * OfferedHtlcSuccessWitnessSize overestimated by about 30% because it
   included an extra signature in the calculation.

 * ToLocalPenaltyWitnessSize was underestimated by one byte, because it
   was missing the length byte for the OP_TRUE. This has implications
   the watchtower protocol since the client and server are assumed to
   share the same weight estimates used for signing. This commit keeps
   the current behavior, with the intention of rolling out negotiation
   for which weight estimate to use for a given session.

 * AcceptedHtlcScriptSize was underestimated by one byte because it was
   missing a length byte for the value 32 pushed on the stack when
   asserting the preimage's length. This affects all AcceptedHtlc*
   witness sizes.
2020-04-10 15:34:27 -07:00
Johan T. Halseth
4fde31229c
lnwallet: rename DelayKey->ToLocalKey, NoDelayKey->ToRemoteKey
Since both parties are going to have their ouputs delayed, we move way
from the DelayKey naming, and instead use ToLocalKey and ToRemoteKey.
2020-01-06 12:08:01 +01:00
Olaoluwa Osuntokun
4b65aea306
watchtower+htlcswitch: update client tower logic to recognize safu commitments
In this commit, we update the tower+link logic to tag a commitment as
the new (tweakless) format if it applies. In order to do this, the
BackupTask method has gained an additional parameter to indicate the
type of commitment that we're attempting to upload. This new tweakless
bool is then threaded through all the way to back up task creation to
ensure that we make the proper input.Input.

Finally, we've added a new test case for each existing test case to test
each case w/ and w/o the tweakless modifier.
2019-09-25 18:25:55 -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
1b89ba1782
watchtower/multi: move BreachHint to blob pkg 2019-06-13 17:40:04 -07:00
Conner Fromknecht
1db9bf2fd4
watchtower/wtdb: create embedded ClientSessionBody
This commit splits out the portions of the ClientSession into an
embedded ClientSessionBody, since these fields will be serialized
together on-disk.
2019-05-23 20:47:49 -07:00
Conner Fromknecht
4642954e72
watchtower/wtclient/backup_task: bind to ClientSession instead of SessionInfo 2019-03-15 02:30:59 -07:00
Conner Fromknecht
a00fc148c8
watchtower/wtclient/backup_task: make sweep pkscript independent of session
This commit changes when the sweep pkscript
is assigned in the construction of the justice
transaction. Currently, the sweep pkscript is
assigned when the task is bound to a session.
However, we will moving to an assignment where
a unique sweep pkscript is used per channel to
prevent address inflation. Hence, this commit
makes the sweep pkscript a state dependent
variable, since it can be known at the time the
channel id is assigned.
2019-02-06 18:24:30 -08:00
Conner Fromknecht
fe9f703b5b
watchtower/wtclient/backup_task: correct txweight + update test vectors 2019-02-06 18:24:30 -08:00
Conner Fromknecht
e13d88f3f3
watchtower/wtclient/backup_task_internal_test: adds backupTask utests 2019-02-05 18:27:19 -08:00
Conner Fromknecht
8f98522f13
watchtower/wtclient/backup_task: adds backupTask 2019-02-05 18:27:13 -08:00