We also increase the witness size for these types to account for the 3
extra bytes. The size won't be correct in all cases, but it is just an
upper bound in any case.
To be able to change more than the witness used for each test case, we
extract commit and sweep tx generation into own methods that can be
called from each test case.
We do the same for TestHTLCReceiverSpendValidation
This fixes an error case that wouldn't have been caught, since
vm.Execute applies more rules than the individual steps (most notably
the clean stack rule).
Instead we execute the engine as normal, and only step through if we
decide that the outcome is unexpected.
Since we never attempt to sweep an HTLC we offered with the preimage on
the remote's commitment, we never use the constant
AcceptedHtlcSuccessWitnessSize for weight estimation. Similarly, we
never timout an HTLC offered by the remote on our own commitment, and
don't need the constant OfferedHtlcTimeoutWitnessSize.
This commit corrects a bug in TxWeightEstimator that could result in
underestimations for transactions involving NestedP2WPKH and NestedP2WSH
inputs. The scriptSig data push is now accounted for in a proper size
constant, and the input count is now incremented in both. This would
only be detectable in the event that the number of non-nested inputs and
the total number of inputs straddle the discontinuities in the
CompactSize encoding, e.g. 253, 2^16-1, or 2^32-1.
In this commit, we update the `CommitSpendNoDelay` method to be aware of
the alternate spending mechanism for commitments that don't have a tweak
for the remote party's non-delay output. We also add a new witness type
so callers can convey their expected signing path.
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.