Make fee check explicit on WasabiWallet side
MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -1065,28 +1065,22 @@ namespace WalletWasabi.Services
builder.SignPSBT(psbt);
psbt.Finalize();
tx = psbt.ExtractTransaction();
- TransactionPolicyError[] checkResults;
- if (psbt.TryGetEstimatedFeeRate(out FeeRate actualFeeRate))
+
+ var checkResults = builder.Check(tx).ToList();
+ if (!psbt.TryGetEstimatedFeeRate(out FeeRate actualFeeRate))
{
+ throw new InvalidOperationException($"Impossible to get the fee rate of the PSBT, this should never happen.");
+ }
+
// Manually check the feerate, because some inaccuracy is possible.
var sb1 = feeRate.SatoshiPerByte;
var sb2 = actualFeeRate.SatoshiPerByte;
if (Math.Abs(sb1 - sb2) > 2) // 2s/b inaccuracy ok.
{
// So it'll generate a transactionpolicy error thrown below.
- checkResults = builder.Check(tx, feeRate);
- }
- else
- {
- checkResults = builder.Check(tx);
+ checkResults.Add(new NotEnoughFundsPolicyError("Fees different than expected"));
}
- }
- else
- {
- checkResults = builder.Check(tx, feeRate);
- }
-
- if (checkResults.Length > 0)
+ if (checkResults.Count > 0)
{
throw new InvalidTxException(tx, checkResults);
}

Make fee check explicit on WasabiWallet side