beignet 0.6.5 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -210,6 +210,10 @@ class Channel {
210
210
  }
211
211
  ];
212
212
  }
213
+ const maxHtlcErr = (0, validation_1.validateU64)(this._state.localConfig.maxHtlcValueInFlightMsat, 'max_htlc_value_in_flight_msat');
214
+ if (maxHtlcErr) {
215
+ return [{ type: channel_actions_1.ChannelActionType.ERROR, message: maxHtlcErr }];
216
+ }
213
217
  const firstPoint = getPerCommitmentPoint(this._state.localPerCommitmentSeed, 0n);
214
218
  const channelTypeFlags = flags_1.FeatureFlags.empty();
215
219
  if (preferTaproot) {
@@ -577,6 +581,10 @@ class Channel {
577
581
  }
578
582
  ];
579
583
  }
584
+ const acceptMaxHtlcErr = (0, validation_1.validateU64)(this._state.localConfig.maxHtlcValueInFlightMsat, 'max_htlc_value_in_flight_msat');
585
+ if (acceptMaxHtlcErr) {
586
+ return [{ type: channel_actions_1.ChannelActionType.ERROR, message: acceptMaxHtlcErr }];
587
+ }
580
588
  const acceptMsg = {
581
589
  temporaryChannelId: this._state.temporaryChannelId,
582
590
  dustLimitSatoshis: this._state.localConfig.dustLimitSatoshis,
@@ -4686,6 +4694,10 @@ class Channel {
4686
4694
  }
4687
4695
  ];
4688
4696
  }
4697
+ const v2MaxHtlcErr = (0, validation_1.validateU64)(params.maxHtlcValueInFlightMsat, 'max_htlc_value_in_flight_msat');
4698
+ if (v2MaxHtlcErr) {
4699
+ return [{ type: channel_actions_1.ChannelActionType.ERROR, message: v2MaxHtlcErr }];
4700
+ }
4689
4701
  this._state.fundingVersion = 2;
4690
4702
  this._state.commitmentFeeratePerkw = params.commitmentFeeratePerkw;
4691
4703
  this._state.fundingLocktime = params.locktime;
@@ -4716,6 +4728,8 @@ class Channel {
4716
4728
  }
4717
4729
  ];
4718
4730
  }
4731
+ this._state.localConfig.maxHtlcValueInFlightMsat =
4732
+ result.message.maxHtlcValueInFlightMsat;
4719
4733
  this._state.dualFundingSession = session;
4720
4734
  this._state.state = types_2.ChannelState.DUAL_FUNDING_V2;
4721
4735
  return [
@@ -4728,6 +4742,10 @@ class Channel {
4728
4742
  { type: channel_actions_1.ChannelActionType.ERROR, message: 'Unexpected open_channel2' }
4729
4743
  ];
4730
4744
  }
4745
+ const acceptV2MaxHtlcErr = (0, validation_1.validateU64)(localParams.maxHtlcValueInFlightMsat, 'max_htlc_value_in_flight_msat');
4746
+ if (acceptV2MaxHtlcErr) {
4747
+ return [{ type: channel_actions_1.ChannelActionType.ERROR, message: acceptV2MaxHtlcErr }];
4748
+ }
4731
4749
  this._state.fundingVersion = 2;
4732
4750
  this._state.commitmentFeeratePerkw = msg.commitmentFeeratePerkw;
4733
4751
  this._state.fundingLocktime = msg.locktime;
@@ -4760,6 +4778,8 @@ class Channel {
4760
4778
  }
4761
4779
  ];
4762
4780
  }
4781
+ this._state.localConfig.maxHtlcValueInFlightMsat =
4782
+ result.message.maxHtlcValueInFlightMsat;
4763
4783
  this._state.dualFundingSession = session;
4764
4784
  this._state.remoteBasepoints = session.getRemoteBasepoints();
4765
4785
  this._state.remoteCurrentPerCommitmentPoint = msg.firstPerCommitmentPoint;