multi: update funding workflow to be aware of new tweakless commits

In this commit, we update the funding workflow to be aware of the new
channel type that doesn't tweak the remote party's output within the
non-delay script on their commitment transaction. To do this, we now
allow the caller of `InnitChannelReservation` to signal if they want the
old or new (tweakless) commitment style.

The funding tests are also updated to test both funding variants, as
we'll still need to understand the legacy format for older nodes.
This commit is contained in:
Olaoluwa Osuntokun committed 2019-09-25 18:25:46 -07:00
1 parent b399203e71
commit 0b62126067
9 files changed
+75 -28

No files matched your search

+6 -1
View File
@@ -106,6 +106,10 @@ type InitFundingReserveMsg struct {
// output selected to fund the channel should satisfy.
MinConfs int32
// Tweakless indicates if the channel should use the new tweakless
// commitment format or not.
Tweakless bool
// err is a channel in which all errors will be sent across. Will be
// nil if this initial set is successful.
//
@@ -489,6 +493,7 @@ func (l *LightningWallet) handleFundingReserveRequest(req *InitFundingReserveMsg
reservation, err := NewChannelReservation(
capacity, localFundingAmt, req.CommitFeePerKw, l, id,
req.PushMSat, l.Cfg.NetParams.GenesisHash, req.Flags,
req.Tweakless,
)
if err != nil {
selected.unlockCoins()
@@ -849,7 +854,7 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
// obfuscator then use it to encode the current state number within
// both commitment transactions.
var stateObfuscator [StateHintSize]byte
if chanState.ChanType == channeldb.SingleFunder {
if chanState.ChanType.IsSingleFunder() {
stateObfuscator = DeriveStateHintObfuscator(
ourContribution.PaymentBasePoint.PubKey,
theirContribution.PaymentBasePoint.PubKey,