Commit Graph

6 Commits

Author SHA1 Message Date
Conner Fromknecht
a0e54a9650
watchtower/lookout: use correct to-local-penalty size for anchors
This commit fixes the to-local-witness estimate to use the correct
witness size estimate for anchor channels. We retain the off-by-one bug
from the original constant otherwise.
2020-09-15 12:48:23 -04:00
Conner Fromknecht
d440cc4024
watchtower/lookout/justice_descriptor: anchor justice txn
This commit modifies the JusticeDescriptor to support creation of
justice transactions spending from anchor commitments. Rather than the
unencumbered p2wkh scripts from before, the tower will now use the
to-remote-confirmed that includes the additional CSV delay of 1. This
also requires setting the sequence number appropriately on the to-remote
input.
2020-09-15 12:44:00 -04:00
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
Conner Fromknecht
09e71a1d49
watchtower/multi: use ComputeJusticeTxOuts, test altruist+reward 2019-02-01 17:30:13 -08: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
0632520f40
watchtower/lookout/justice_descriptor: adds justice txn creation 2018-10-31 20:42:10 -07:00