Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Dec 18, 2024
1 parent 4780a7f commit 1925a58
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 91 deletions.
6 changes: 3 additions & 3 deletions NBitcoin.Bench/NBitcoin.Bench.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.14.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions NBitcoin.Tests/AssertEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AssertEx
[DebuggerHidden]
internal static void Error(string msg)
{
Assert.False(true, msg);
Assert.Fail(msg);
}
[DebuggerHidden]
internal static void Equal<T>(T actual, T expected)
Expand All @@ -25,12 +25,12 @@ internal static void Equal<T>(T actual, T expected)
internal static void CollectionEquals<T>(T[] actual, T[] expected)
{
if (actual.Length != expected.Length)
Assert.False(true, "Actual.Length(" + actual.Length + ") != Expected.Length(" + expected.Length + ")");
Assert.Fail("Actual.Length(" + actual.Length + ") != Expected.Length(" + expected.Length + ")");

for (int i = 0; i < actual.Length; i++)
{
if (!Object.Equals(actual[i], expected[i]))
Assert.False(true, "Actual[" + i + "](" + actual[i] + ") != Expected[" + i + "](" + expected[i] + ")");
Assert.Fail("Actual[" + i + "](" + actual[i] + ") != Expected[" + i + "](" + expected[i] + ")");
}
}
[DebuggerHidden]
Expand Down
29 changes: 13 additions & 16 deletions NBitcoin.Tests/NBitcoin.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,30 @@
<RemoveBC>true</RemoveBC>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FsCheck" Version="2.13.0" />
<PackageReference Include="FsCheck.Xunit" Version="2.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="FsCheck" Version="2.16.6" />
<PackageReference Include="FsCheck.Xunit" Version="2.16.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<ProjectReference Include="..\NBitcoin\NBitcoin.csproj" />
<ProjectReference Include="..\NBitcoin.Altcoins\NBitcoin.Altcoins.csproj" />
<ProjectReference Include="..\NBitcoin.TestFramework\NBitcoin.TestFramework.csproj" />
<PackageReference Include="Microsoft.CSharp" Version="4.6.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0"></PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
<PackageReference Include="System.Globalization.Extensions" Version="4.3.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" />
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />

</ItemGroup>

<!--Those package must be removed once FsCheck is removed or can be updated to non vulnerable version-->
<ItemGroup>
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<Reference Include="System.Net.Http" />
</ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions NBitcoin.Tests/ProtocolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public void CanProcessAddressGossip()

[Fact]
[Trait("Protocol", "Protocol")]
public void CanHandshakeRestrictNodes()
public async Task CanHandshakeRestrictNodes()
{
using (var builder = NodeBuilderEx.Create())
{
Expand All @@ -303,7 +303,7 @@ public void CanHandshakeRestrictNodes()
try
{
group.Connect();
connecting.GetAwaiter().GetResult();
await connecting;
}
catch (TaskCanceledException)
{
Expand All @@ -322,7 +322,7 @@ public void CanHandshakeRestrictNodes()
try
{
group.Connect();
connecting.GetAwaiter().GetResult();
await connecting;
Eventually(() =>
{
Assert.NotEmpty(group.ConnectedNodes);
Expand All @@ -339,7 +339,7 @@ public void CanHandshakeRestrictNodes()

[Fact]
[Trait("Protocol", "Protocol")]
public void CanHandshakeWithSeveralTemplateBehaviors()
public async Task CanHandshakeWithSeveralTemplateBehaviors()
{
using (var builder = NodeBuilderEx.Create())
{
Expand Down Expand Up @@ -371,7 +371,7 @@ public void CanHandshakeWithSeveralTemplateBehaviors()
{

group.Connect();
connecting.GetAwaiter().GetResult();
await connecting;
Eventually(() =>
{
Assert.Equal(101, chain.Height);
Expand Down Expand Up @@ -670,7 +670,7 @@ public void CanCancelConnection()
{
ConnectCancellation = cts.Token
});
Assert.False(true, "Should have thrown");
Assert.Fail("Should have thrown");
}
catch (OperationCanceledException)
{
Expand Down
36 changes: 18 additions & 18 deletions NBitcoin.Tests/RPCClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void CanGetNewAddress()
}

[Fact]
public void CanUseMultipleWallets()
public async Task CanUseMultipleWallets()
{
using (var builder = NodeBuilderEx.Create())
{
Expand All @@ -114,7 +114,7 @@ public void CanUseMultipleWallets()
node.Start();
var rpc = node.CreateRPCClient();
var w1 = rpc.CreateWallet("w1");
w1.SendCommandAsync(RPCOperations.getwalletinfo).GetAwaiter().GetResult().ThrowIfError();
(await w1.SendCommandAsync(RPCOperations.getwalletinfo)).ThrowIfError();
Assert.NotNull(w1.GetBalance());
Assert.NotNull(rpc.GetBestBlockHash());
var address = w1.GetNewAddress();
Expand All @@ -128,9 +128,9 @@ public void CanUseMultipleWallets()
var b2 = rpc.GetBestBlockHashAsync();
var a = w1b.SendCommandAsync(RPCOperations.gettransaction, block.Transactions.First().GetHash().ToString());
rpc.SendBatch();
b.GetAwaiter().GetResult();
b2.GetAwaiter().GetResult();
a.GetAwaiter().GetResult();
await b;
await b2;
await a;

var noWalletRPC = noWalletNode.CreateRPCClient();
Assert.Throws<RPCException>(() => noWalletRPC.GetNewAddress());
Expand Down Expand Up @@ -271,15 +271,15 @@ public async Task RPCBatchingCanFallbackIfAccessForbidden()
}

[Fact]
public void CanUseAsyncRPC()
public async Task CanUseAsyncRPC()
{
using (var builder = NodeBuilderEx.Create())
{
var node = builder.CreateNode();
var rpc = node.CreateRPCClient();
builder.StartAll();
node.Generate(10);
var blkCount = rpc.GetBlockCountAsync().Result;
var blkCount = await rpc.GetBlockCountAsync();
Assert.Equal(10, blkCount);
}
}
Expand Down Expand Up @@ -588,7 +588,7 @@ public async Task CanGetTxOutFromRPCAsync()
index = i;
}
}
Assert.NotEqual(index, -1);
Assert.NotEqual(-1, index);

// 5. Make sure the expected amounts are received for unconfirmed transactions
getTxOutResponse = await rpc.GetTxOutAsync(txId, index, true);
Expand Down Expand Up @@ -1236,7 +1236,7 @@ public async Task CanBatchRequestPartiallySucceed()
}
}
[Fact]
public void CanUseBatchedRequests()
public async Task CanUseBatchedRequests()
{
using (var builder = NodeBuilderEx.Create())
{
Expand All @@ -1261,7 +1261,7 @@ public void CanUseBatchedRequests()
int blockIndex = 0;
foreach (var req in requests)
{
Assert.Equal(blocks[blockIndex], req.Result);
Assert.Equal(blocks[blockIndex], await req);
Assert.Equal(TaskStatus.RanToCompletion, req.Status);
blockIndex++;
}
Expand Down Expand Up @@ -1628,7 +1628,7 @@ public void CanParseEndpoint()
}

[Fact]
public void CanAuthWithCookieFile()
public async Task CanAuthWithCookieFile()
{
#if NOFILEIO
Assert.Throws<NotSupportedException>(() => new RPCClient(Network.Main));
Expand Down Expand Up @@ -1656,14 +1656,14 @@ public void CanAuthWithCookieFile()
rpc = rpc.PrepareBatch();
var blockCountAsync = rpc.GetBlockCountAsync();
rpc.SendBatch();
var blockCount = blockCountAsync.GetAwaiter().GetResult();
var blockCount = await blockCountAsync;

node.Restart();

rpc = rpc.PrepareBatch();
blockCountAsync = rpc.GetBlockCountAsync();
rpc.SendBatch();
blockCount = blockCountAsync.GetAwaiter().GetResult();
blockCount = await blockCountAsync;

rpc = new RPCClient("bla:bla", "http://toto/", Network.RegTest);
}
Expand All @@ -1681,13 +1681,13 @@ public void RPCSendRPCException()
try
{
rpcClient.SendCommand("whatever");
Assert.False(true, "Should have thrown");
Assert.Fail("Should have thrown");
}
catch (RPCException ex)
{
if (ex.RPCCode != RPCErrorCode.RPC_METHOD_NOT_FOUND)
{
Assert.False(true, "Should have thrown RPC_METHOD_NOT_FOUND");
Assert.Fail("Should have thrown RPC_METHOD_NOT_FOUND");
}
}
}
Expand Down Expand Up @@ -1951,7 +1951,7 @@ public void ShouldWalletProcessPSBTAndExtractMempoolAcceptableTX()
// 3. In version 0.17, `importmulti` can not handle witness script so only p2sh are considered here. TODO: fix
[Theory]
[InlineData("latest")]
public void ShouldPerformMultisigProcessingWithCore(string version)
public async Task ShouldPerformMultisigProcessingWithCore(string version)
{
using (var builder = NodeBuilderEx.Create(NodeDownloadData.Bitcoin.FromVersion(version)))
{
Expand Down Expand Up @@ -2027,7 +2027,7 @@ public void ShouldPerformMultisigProcessingWithCore(string version)
// first carol creates psbt
var carol = clients[2];
// check if we have enough balance
var info = carol.GetBlockchainInfoAsync().Result;
var info = await carol.GetBlockchainInfoAsync();
Assert.Equal((ulong)104, info.Blocks);
var balance = carol.GetBalance(0, true);
// Assert.Equal(Money.Coins(120), balance);
Expand Down Expand Up @@ -2196,7 +2196,7 @@ void AssertException<T>(Action act, Action<T> assert) where T : Exception
try
{
act();
Assert.False(true, "Should have thrown an exception");
Assert.Fail("Should have thrown an exception");
}
catch (T ex)
{
Expand Down
9 changes: 3 additions & 6 deletions NBitcoin.Tests/RepositoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,13 @@ public void TwoGroupsCanSendToSameDestination()
Assert.Equal(3, tx.Outputs.Count);
Assert.Single(tx.Outputs
.Where(o => o.ScriptPubKey == bob.GetScriptPubKey(ScriptPubKeyType.Legacy))
.Where(o => o.Value == Money.Coins(0.3m) + Money.Coins(0.1m))
);
, o => o.Value == Money.Coins(0.3m) + Money.Coins(0.1m));
Assert.Single(tx.Outputs
.Where(o => o.ScriptPubKey == alice.GetScriptPubKey(ScriptPubKeyType.Legacy))
.Where(o => o.Value == Money.Coins(0.7m))
);
, o => o.Value == Money.Coins(0.7m));
Assert.Single(tx.Outputs
.Where(o => o.ScriptPubKey == carol.GetScriptPubKey(ScriptPubKeyType.Legacy))
.Where(o => o.Value == Money.Coins(1.0m))
);
, o => o.Value == Money.Coins(1.0m));
}

[Fact]
Expand Down
Loading

0 comments on commit 1925a58

Please sign in to comment.