Remove all !ModelState.IsValid
MODIFY
WalletWasabi.Backend/Controllers/BatchController.cs
WalletWasabi.Backend/Controllers/BatchController.cs
@@ -39,11 +39,6 @@ namespace WalletWasabi.Backend.Controllers
[HttpGet("synchronize")]
public async Task<IActionResult> GetSynchronizeAsync([FromQuery, Required] string bestKnownBlockHash, [FromQuery, Required] int maxNumberOfFilters, [FromQuery] string? estimateSmartFeeMode = nameof(EstimateSmartFeeMode.Conservative))
{
- if (!ModelState.IsValid)
- {
- return BadRequest("Wrong body is provided.");
- }
-
bool estimateSmartFee = !string.IsNullOrWhiteSpace(estimateSmartFeeMode);
EstimateSmartFeeMode mode = EstimateSmartFeeMode.Conservative;
if (estimateSmartFee)

MODIFY
WalletWasabi.Backend/Controllers/BlockchainController.cs
WalletWasabi.Backend/Controllers/BlockchainController.cs
@@ -60,7 +60,7 @@ namespace WalletWasabi.Backend.Controllers
[ResponseCache(Duration = 300, Location = ResponseCacheLocation.Client)]
public async Task<IActionResult> GetAllFeesAsync([FromQuery, Required] string estimateSmartFeeMode)
{
- if (!ModelState.IsValid || !Enum.TryParse(estimateSmartFeeMode, ignoreCase: true, out EstimateSmartFeeMode mode))
+ if (!Enum.TryParse(estimateSmartFeeMode, ignoreCase: true, out EstimateSmartFeeMode mode))
{
return BadRequest("Invalid estimation mode is provided, possible values: ECONOMICAL/CONSERVATIVE.");
}
@@ -94,7 +94,7 @@ namespace WalletWasabi.Backend.Controllers
[ResponseCache(Duration = 3, Location = ResponseCacheLocation.Client)]
public async Task<IActionResult> GetMempoolHashesAsync([FromQuery] int compactness = 64)
{
- if (compactness < 1 || compactness > 64 || !ModelState.IsValid)
+ if (compactness < 1 || compactness > 64)
{
return BadRequest("Invalid compactness parameter is provided.");
}
@@ -141,11 +141,6 @@ namespace WalletWasabi.Backend.Controllers
[ProducesResponseType(400)]
public async Task<IActionResult> GetTransactionsAsync([FromQuery, Required] IEnumerable<string> transactionIds)
{
- if (!ModelState.IsValid)
- {
- return BadRequest("Invalid transaction Ids.");
- }
-
var maxTxToRequest = 10;
if (transactionIds.Count() > maxTxToRequest)
{
@@ -245,11 +240,6 @@ namespace WalletWasabi.Backend.Controllers
[ProducesResponseType(400)]
public async Task<IActionResult> BroadcastAsync([FromBody, Required] string hex)
{
- if (!ModelState.IsValid)
- {
- return BadRequest("Invalid hex.");
- }
-
Transaction transaction;
try
{
@@ -303,7 +293,7 @@ namespace WalletWasabi.Backend.Controllers
[ProducesResponseType(404)]
public IActionResult GetFilters([FromQuery, Required] string bestKnownBlockHash, [FromQuery, Required] int count)
{
- if (count <= 0 || !ModelState.IsValid)
+ if (count <= 0)
{
return BadRequest("Invalid block hash or count is provided.");
}

MODIFY
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
@@ -104,7 +104,7 @@ namespace WalletWasabi.Backend.Controllers
public async Task<IActionResult> PostInputsAsync([FromBody, Required] InputsRequest4 request)
{
// Validate request.
- if (request.RoundId < 0 || !ModelState.IsValid)
+ if (request.RoundId < 0)
{
return BadRequest("Invalid request.");
}
@@ -366,7 +366,7 @@ namespace WalletWasabi.Backend.Controllers
[ProducesResponseType(410)]
public async Task<IActionResult> PostConfirmationAsync([FromQuery, Required] string uniqueId, [FromQuery, Required] long roundId)
{
- if (roundId < 0 || !ModelState.IsValid)
+ if (roundId < 0)
{
return BadRequest();
}
@@ -427,7 +427,7 @@ namespace WalletWasabi.Backend.Controllers
[ProducesResponseType(410)]
public IActionResult PostUnconfimation([FromQuery, Required] string uniqueId, [FromQuery, Required] long roundId)
{
- if (roundId < 0 || !ModelState.IsValid)
+ if (roundId < 0)
{
return BadRequest();
}
@@ -488,9 +488,7 @@ namespace WalletWasabi.Backend.Controllers
[ProducesResponseType(410)]
public async Task<IActionResult> PostOutputAsync([FromQuery, Required] long roundId, [FromBody, Required] OutputRequest request)
{
- if (roundId < 0
- || request.Level < 0
- || !ModelState.IsValid)
+ if (roundId < 0 || request.Level < 0)
{
return BadRequest();
}
@@ -585,7 +583,7 @@ namespace WalletWasabi.Backend.Controllers
[ProducesResponseType(410)]
public IActionResult GetCoinJoin([FromQuery, Required] string uniqueId, [FromQuery, Required] long roundId)
{
- if (roundId < 0 || !ModelState.IsValid)
+ if (roundId < 0)
{
return BadRequest();
}
@@ -641,8 +639,7 @@ namespace WalletWasabi.Backend.Controllers
{
if (roundId < 0
|| !signatures.Any()
- || signatures.Any(x => x.Key < 0 || string.IsNullOrWhiteSpace(x.Value))
- || !ModelState.IsValid)
+ || signatures.Any(x => x.Key < 0 || string.IsNullOrWhiteSpace(x.Value)))
{
return BadRequest();
}
@@ -746,7 +743,7 @@ namespace WalletWasabi.Backend.Controllers
private Guid GetGuidOrFailureResponse(string uniqueId, out IActionResult returnFailureResponse)
{
returnFailureResponse = null;
- if (string.IsNullOrWhiteSpace(uniqueId) || !ModelState.IsValid)
+ if (string.IsNullOrWhiteSpace(uniqueId))
{
returnFailureResponse = BadRequest($"Invalid {nameof(uniqueId)} provided.");
}

Remove all !ModelState.IsValid