Skip to content

Commit

Permalink
Fix warns (WalletWasabi#13232)
Browse files Browse the repository at this point in the history
* Remove static file middleware

* Fix a few warnings
  • Loading branch information
lontivero authored Jul 25, 2024
1 parent cb570da commit 393b728
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public Startup(IConfiguration configuration)

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseStaticFiles();
app.UseRouting();
app.UseEndpoints(endpoints => endpoints.MapControllers());
}
Expand Down
2 changes: 1 addition & 1 deletion WalletWasabi/BitcoinCore/CoreNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public CoreNode(string dataDir, Network network, MempoolService mempoolService,
public EndPoint P2pEndPoint { get; }
public EndPoint RpcEndPoint { get; }
public IRPCClient RpcClient { get; }
private BitcoindRpcProcessBridge Bridge { get; set; }
private BitcoindRpcProcessBridge? Bridge { get; set; }
public string DataDir { get; }
public Network Network { get; }
public MempoolService MempoolService { get; }
Expand Down
4 changes: 2 additions & 2 deletions WalletWasabi/BitcoinCore/Rpc/RpcParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static VerboseBlockInfo ParseVerboseBlockResponse(string getBlockResponse
outPoint: new OutPoint(uint256.Parse(txInJson.GetProperty("txid").GetString()), txInJson.GetProperty("vout").GetUInt32()),
prevOutput: new VerboseOutputInfo(
value: Money.Coins(prevOut.GetProperty("value").GetDecimal()),
scriptPubKey: Script.FromHex(scriptPubKey.GetProperty("hex").GetString()),
scriptPubKey: Script.FromHex(scriptPubKey.GetProperty("hex").GetString()!),
pubkeyType: scriptPubKey.GetProperty("type").GetString()));
}

Expand All @@ -86,7 +86,7 @@ public static VerboseBlockInfo ParseVerboseBlockResponse(string getBlockResponse
var scriptPubKey = txoutJson.GetProperty("scriptPubKey");
var output = new VerboseOutputInfo(
value: Money.Coins(txoutJson.GetProperty("value").GetDecimal()),
scriptPubKey: Script.FromHex(scriptPubKey.GetProperty("hex").GetString()),
scriptPubKey: Script.FromHex(scriptPubKey.GetProperty("hex").GetString()!),
pubkeyType: scriptPubKey.GetProperty("type").GetString());

outputs.Add(output);
Expand Down
18 changes: 14 additions & 4 deletions WalletWasabi/Rpc/JsonRpcRequestHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices.JavaScript;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
Expand Down Expand Up @@ -119,7 +120,16 @@ private async Task<string> HandleRequestAsync(string path, JsonRpcRequest jsonRp
$"A value for the '{parameter.name}' is missing.",
jsonRpcRequest.Id);
}
parameters.Add(jObj[parameter.name].ToObject(parameter.type, DefaultSerializer));

var parameterValue = jObj[parameter.name]!;
if (parameterValue.ToObject(parameter.type, DefaultSerializer) is not { } parameterTypedValue)
{
return Error(
JsonRpcErrorCodes.InvalidParams,
$"A value for the '{parameter.name}' is not of the expected type.",
jsonRpcRequest.Id);
}
parameters.Add(parameterTypedValue);
}
}

Expand Down Expand Up @@ -156,17 +166,17 @@ private async Task<string> HandleRequestAsync(string path, JsonRpcRequest jsonRp
return "";
}

JsonRpcResponse? response = null;
JsonRpcResponse? response;
if (procedureMetadata.MethodInfo.IsAsync())
{
if (!procedureMetadata.MethodInfo.ReturnType.IsGenericType)
{
await ((Task)result).ConfigureAwait(false);
await ((Task)result!).ConfigureAwait(false);
response = JsonRpcResponse.CreateResultResponse(jsonRpcRequest.Id);
}
else
{
var ret = await ((dynamic)result).ConfigureAwait(false);
var ret = await ((dynamic)result!).ConfigureAwait(false);
response = JsonRpcResponse.CreateResultResponse(jsonRpcRequest.Id, ret);
}
}
Expand Down
4 changes: 2 additions & 2 deletions WalletWasabi/WebClients/PayJoin/PayjoinClientParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace WalletWasabi.WebClients.PayJoin;

public class PayjoinClientParameters
{
public Money MaxAdditionalFeeContribution { get; set; }
public FeeRate MinFeeRate { get; set; }
public Money? MaxAdditionalFeeContribution { get; set; }
public FeeRate? MinFeeRate { get; set; }
public int? AdditionalFeeOutputIndex { get; set; }
public bool DisableOutputSubstitution { get; set; }
public int Version { get; set; } = 1;
Expand Down

0 comments on commit 393b728

Please sign in to comment.