UT for reproducing the problem
ADD
WalletWasabi.Tests/UnitTests/WabiSabi/Models/ConstructionStateTests.cs
+using NBitcoin;
+using WalletWasabi.Helpers;
+using WalletWasabi.Tests.Helpers;
+using WalletWasabi.WabiSabi.Backend;
+using WalletWasabi.WabiSabi.Backend.Models;
+using WalletWasabi.WabiSabi.Backend.Rounds;
+using WalletWasabi.WabiSabi.Models;
+using WalletWasabi.WabiSabi.Models.MultipartyTransaction;
+using Xunit;
+
+namespace WalletWasabi.Tests.UnitTests.WabiSabi.Models;
+
+public class ConstructionStateTests
+{
+ [Fact]
+ public void ConstructionStateFeeRateCalculation()
+ {
+ var miningFeeRate = new FeeRate(8m);
+ var cfg = new WabiSabiConfig();
+ var roundParameters = RoundParameters.Create(
+ cfg,
+ Network.Main,
+ miningFeeRate,
+ cfg.CoordinationFeeRate,
+ Money.Coins(10));
+
+ var round = WabiSabiFactory.CreateRound(roundParameters);
+ var state = round.Assert<ConstructionState>();
+
+ var (coin, ownershipProof) = WabiSabiFactory.CreateCoinWithOwnershipProof(
+ amount: roundParameters.AllowedInputAmounts.Min + miningFeeRate.GetFee(Constants.P2wpkhInputVirtualSize),
+ roundId: round.Id);
+ state = state.AddInput(coin, ownershipProof, WabiSabiFactory.CreateCommitmentData(round.Id));
+ state = state.AddOutput(new TxOut(roundParameters.AllowedInputAmounts.Min, new Script("0 bf3593d140d512eb607b3ddb5c5ee085f1e3a210") ));
+
+ var ex = Assert.Throws<WabiSabiProtocolException>(() => state.Finalize());
+ Assert.Equal(WabiSabiProtocolErrorCode.InsufficientFees, ex.ErrorCode);
+ }
+}

UT for reproducing the problem