Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create ReservedUtxoService #2

Merged
merged 19 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/FodyNlogAdapter/FodyNlogAdapter.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>FodyNlogAdapter</AssemblyName>
<Version>3.0.8.0</Version>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
Expand All @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NLog" Version="5.0.0-beta09" />
<PackageReference Include="NLog" Version="4.7.3" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/NBitcoin/NBitcoin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>NBitcoin</RootNamespace>
<PackageId>NStratis</PackageId>
<Authors>NStratis</Authors>
Expand Down Expand Up @@ -42,7 +42,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NStratis.HashLib" Version="1.0.0.1" />
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc4" />
<PackageReference Include="System.Reactive" Version="4.0.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Stratis Bitcoin Features BlockStore</Description>
<AssemblyTitle>Stratis.Bitcoin.Features.BlockStore</AssemblyTitle>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Stratis.Bitcoin.Features.BlockStore</AssemblyName>
<PackageId>Stratis.Bitcoin.Features.BlockStore</PackageId>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
Expand All @@ -25,7 +25,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using Stratis.Bitcoin.Features.MemoryPool.Rules;
using Stratis.Bitcoin.Features.Wallet;
using Stratis.Bitcoin.Features.Wallet.Interfaces;
using Stratis.Bitcoin.Features.Wallet.Services;
using Stratis.Bitcoin.Networks.Policies;
using Stratis.Bitcoin.Signals;
using Stratis.Bitcoin.Tests.Common;
Expand Down Expand Up @@ -224,15 +225,18 @@ private void Initialize([System.Runtime.CompilerServices.CallerMemberName] strin

var scriptDestinationReader = new ColdStakingDestinationReader(new ScriptAddressReader());

IWalletRepository walletRepository = new SQLiteWalletRepository(this.loggerFactory, this.nodeSettings.DataFolder, this.Network, DateTimeProvider.Default, scriptDestinationReader);
walletRepository.TestMode = true;
IWalletRepository walletRepository = new SQLiteWalletRepository(this.loggerFactory, this.nodeSettings.DataFolder, this.Network, DateTimeProvider.Default, scriptDestinationReader)
{
TestMode = true
};

this.coldStakingManager = new ColdStakingManager(this.Network, new ChainIndexer(this.Network), walletSettings, this.nodeSettings.DataFolder,
new Mock<IWalletFeePolicy>().Object, new Mock<IAsyncProvider>().Object, new NodeLifetime(), scriptDestinationReader,
this.loggerFactory, DateTimeProvider.Default, walletRepository);

var walletTransactionHandler = new WalletTransactionHandler(this.loggerFactory, this.coldStakingManager,
new Mock<IWalletFeePolicy>().Object, this.Network, new StandardTransactionPolicy(this.Network));
var reserveUtxoService = new ReserveUtxoService(this.loggerFactory, new Mock<ISignals>().Object);

var walletTransactionHandler = new WalletTransactionHandler(this.loggerFactory, this.coldStakingManager, new Mock<IWalletFeePolicy>().Object, this.Network, new StandardTransactionPolicy(this.Network), reserveUtxoService);

this.coldStakingController = new ColdStakingController(this.loggerFactory, this.coldStakingManager, walletTransactionHandler);

Expand Down Expand Up @@ -289,9 +293,6 @@ public void ColdStakingVerifyWalletAddresses()
this.coldStakingManager.GetOrCreateColdStakingAccount(walletName2, true, walletPassword);
this.coldStakingManager.GetOrCreateColdStakingAccount(walletName2, false, walletPassword);

var wallet1 = this.coldStakingManager.GetWallet(walletName1);
var wallet2 = this.coldStakingManager.GetWallet(walletName2);

HdAddress coldAddress1 = this.coldStakingManager.GetFirstUnusedColdStakingAddress(walletName1, true);
HdAddress hotAddress1 = this.coldStakingManager.GetFirstUnusedColdStakingAddress(walletName1, false);
HdAddress coldAddress2 = this.coldStakingManager.GetFirstUnusedColdStakingAddress(walletName2, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,14 @@ public IActionResult SetupColdStaking([FromBody]SetupColdStakingRequest request)
Money feeAmount = Money.Parse(request.Fees);

Transaction transaction = this.ColdStakingManager.GetColdStakingSetupTransaction(
this.walletTransactionHandler, request.ColdWalletAddress, request.HotWalletAddress,
request.WalletName, request.WalletAccount, request.WalletPassword, amount, feeAmount);
this.walletTransactionHandler,
request.ColdWalletAddress,
request.HotWalletAddress,
request.WalletName,
request.WalletAccount,
request.WalletPassword,
amount,
feeAmount);

var model = new SetupColdStakingResponse
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Stratis Bitcoin Features Consensus</Description>
<AssemblyTitle>Stratis.Bitcoin.Features.Consensus</AssemblyTitle>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Stratis.Bitcoin.Features.Consensus</AssemblyName>
<PackageId>Stratis.Bitcoin.Features.Consensus</PackageId>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
Expand All @@ -28,7 +28,10 @@
<PackageReference Include="LevelDB.Standard" Version="2.1.6.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Microsoft.FASTER" Version="2020.2.1.1" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Stratis Bitcoin Features Dns</Description>
<AssemblyTitle>Stratis.Bitcoin.Features.Dns</AssemblyTitle>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Stratis.Bitcoin.Features.Dns</AssemblyName>
<PackageId>Stratis.Bitcoin.Features.Dns</PackageId>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
Expand All @@ -21,8 +21,11 @@

<ItemGroup>
<PackageReference Include="DNS" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.11" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Stratis Bitcoin Features MemoryPool</Description>
<AssemblyTitle>Stratis.Bitcoin.Features.MemoryPool</AssemblyTitle>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Stratis.Bitcoin.Features.MemoryPool</AssemblyName>
<PackageId>Stratis.Bitcoin.Features.MemoryPool</PackageId>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
Expand All @@ -25,7 +25,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool
/// <summary>
/// Event that is executed when a transaction is removed from the mempool.
/// </summary>
/// <seealso cref="Stratis.Bitcoin.EventBus.EventBase" />
/// <seealso cref="EventBase" />
public class TransactionAddedToMemoryPool : EventBase
{
public Transaction AddedTransaction { get; }
Expand Down
2 changes: 0 additions & 2 deletions src/Stratis.Bitcoin.Features.MemoryPool/TxMemPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public class TxMempoolInfo
public long FeeDelta { get; set; }
}

;

/// <summary>
/// Memory pool of pending transactions.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion src/Stratis.Bitcoin.Features.Miner/BlockDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ private void Configure()
/// </summary>
/// <param name="chainTip">Tip of the chain that this instance will work with without touching any shared chain resources.</param>
/// <param name="scriptPubKey">Script that explains what conditions must be met to claim ownership of a coin.</param>
/// <returns>The contructed <see cref="Mining.BlockTemplate"/>.</returns>
protected void OnBuild(ChainedHeader chainTip, Script scriptPubKey)
{
this.Configure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.11" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Stratis Bitcoin Features Notifications</Description>
<AssemblyTitle>Stratis.Bitcoin.Features.Notifications</AssemblyTitle>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Stratis.Bitcoin.Features.Notifications</AssemblyName>
<PackageId>Stratis.Bitcoin.Features.Notifications</PackageId>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
Expand All @@ -25,7 +25,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public class TestPoAMiner : PoAMiner

private readonly ISlotsManager slotsManager;

private readonly IConsensusManager consensusManager;

public TestPoAMiner(
IConsensusManager consensusManager,
IDateTimeProvider dateTimeProvider,
Expand All @@ -50,7 +48,6 @@ public TestPoAMiner(

this.cancellation = new CancellationTokenSource();
this.slotsManager = slotsManager;
this.consensusManager = consensusManager;
}

public override void InitializeMining()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
<PackageReference Include="Tracer.Fody" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Loading