Commit bca4f4d4 authored by Sergei Zubov's avatar Sergei Zubov

Merge branch 'test' into 'release'

Exclude transactions with too-new timestamps from block template

See merge request !6
parents b2494f8f 0d09415c
Pipeline #1247 passed with stages
in 4 minutes and 12 seconds
......@@ -5,7 +5,7 @@ stages:
- deploy_to_test
- run_tests
- deploy_node_to_prod
- deploy_seed_to_prod
- deploy_other_nodes_to_prod
variables:
DOCKER_DRIVER: overlay2
......@@ -76,7 +76,7 @@ run_test:
name: ${CI_COMMIT_REF_NAME}
url: https://xvideos.com
only:
- test
- test1
tags:
- buidl1-dind
......@@ -91,4 +91,26 @@ deploy_node_to_prod:
only:
- release
tags:
- buidl1-shell
\ No newline at end of file
- buidl1-shell
deploy_other_nodes_to_prod:
stage: deploy_other_nodes_to_prod
image: docker:stable-git
# services:
# - docker:dind
script:
- sed 's|_IMAGE_NAME_|'"${CI_REGISTRY_IMAGE}/prod"'|g; s|_VERSION_|'"${CI_PIPELINE_ID}"'|g' app-dst-client.tpl.yml > app-dst-client.yml; cat app-dst-client.yml
- sed 's|_IMAGE_NAME_|'"${CI_REGISTRY_IMAGE}/prod"'|g; s|_VERSION_|'"${CI_PIPELINE_ID}"'|g' app-nako-scanner.tpl.yml > app-nako-scanner.yml; cat app-nako-scanner.yml
- wget https://storage.googleapis.com/kubernetes-release/release/v1.13.3/bin/linux/amd64/kubectl && chmod +x ./kubectl
- wget https://github.com/garethr/kubeval/releases/download/0.7.3/kubeval-linux-amd64.tar.gz && tar xvf kubeval-linux-amd64.tar.gz
- ./kubeval app-dst-client.yml
- ./kubeval app-nako-scanner.yml
- ./kubectl apply -f app-dst-client.yml
- ./kubectl apply -f app-nako-scanner.yml
environment:
name: ${CI_COMMIT_REF_NAME}
url: https://xvideos.com
only:
- release
tags:
- buidl1-dind
FROM microsoft/dotnet:2.1-sdk-alpine AS builder
WORKDIR /app
COPY ./Sources ./
......@@ -9,7 +10,11 @@ RUN cd DeStream.DeStreamD \
&& dotnet publish -c Release --framework netcoreapp2.1 --runtime alpine-x64 -o out
FROM microsoft/dotnet:2.1-runtime-alpine
WORKDIR /app
RUN apk update && apk add curl
COPY --from=builder /app/DeStream.DeStreamD/out .
ENTRYPOINT ["dotnet", "DeStream.DeStreamD.dll"]
\ No newline at end of file
......@@ -357,7 +357,6 @@ Global
{FF6DDE2B-CF33-438F-BCC8-B1E109AB2472}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF6DDE2B-CF33-438F-BCC8-B1E109AB2472}.Release|Any CPU.Build.0 = Release|Any CPU
{6A4C72BF-E818-45B1-9DD4-562C7C6F31C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A4C72BF-E818-45B1-9DD4-562C7C6F31C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A4C72BF-E818-45B1-9DD4-562C7C6F31C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A4C72BF-E818-45B1-9DD4-562C7C6F31C8}.Release|Any CPU.Build.0 = Release|Any CPU
{C1D739B1-79CB-4D42-8147-3A31D1B84868}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
......
......@@ -38,7 +38,7 @@ namespace FodyNlogAdapter.Adapters
}
[DebuggerStepThrough]
public void TraceEnter(string methodInfo, string[] paramNames, object[] paramValues)
public void TraceEnter(string methodInfo, Tuple<string, string>[] methodParameters, string[] paramNames, object[] paramValues)
{
if (this.logger.IsTraceEnabled)
{
......@@ -72,7 +72,7 @@ namespace FodyNlogAdapter.Adapters
}
[DebuggerStepThrough]
public void TraceLeave(string methodInfo, long startTicks, long endTicks, string[] paramNames, object[] paramValues)
public void TraceLeave(string methodInfo, Tuple<string, string>[] methodParameters, long startTicks, long endTicks, string[] paramNames, object[] paramValues)
{
if (this.logger.IsTraceEnabled)
{
......
......@@ -2,9 +2,12 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>Stratis.FodyNlogAdapter</PackageId>
<Version>3.0.0.0</Version>
<AssemblyName>FodyNlogAdapter</AssemblyName>
<Version>3.0.6.0-beta</Version>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Authors>Stratis Group Ltd.</Authors>
<PackageId>Stratis.FodyNlogAdapter</PackageId>
<Product>Stratis.FodyNlogAdapter</Product>
</PropertyGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<Weavers GenerateXsd="false">
<Tracer adapterAssembly="FodyNlogAdapter"
logManager="FodyNlogAdapter.Adapters.LogManagerAdapter"
logger="FodyNlogAdapter.Adapters.LoggerAdapter"
......@@ -9,6 +9,9 @@
<TraceOn namespace="Stratis.Bitcoin+*" class="private" method="private" />
<TraceOn namespace="Stratis.SmartContracts.Core+*" class="private" method="private" />
<TraceOn namespace="Stratis.SmartContracts.CLR+*" class="private" method="private" />
<TraceOn namespace="Stratis.Bitcoin.Features.PoA+*" class="private" method="private" />
<TraceOn namespace="Stratis.Features.FederatedPeg+*" class="private" method="private" />
<TraceOn namespace="Stratis.Bitcoin.Features.SmartContracts+*" class="private" method="private" />
<NoTrace namespace="Stratis.Bitcoin.Features.Consensus+*" />
<NoTrace namespace="Stratis.Bitcoin.Features.Miner+*" />
<NoTrace namespace="*.Tests+*" />
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -26,7 +26,7 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.5.0" />
<PackageReference Include="System.Reactive" Version="4.0.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -10,7 +10,7 @@
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -25,7 +25,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -19,7 +19,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="2.0.0" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -26,7 +26,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -22,7 +22,7 @@
<ItemGroup>
<PackageReference Include="DNS" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -19,7 +19,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="2.0.0" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
......@@ -103,6 +103,8 @@ namespace Stratis.Bitcoin.Features.MemoryPool
this.PerformanceCounter.SetMempoolSize(state.MempoolSize);
this.PerformanceCounter.SetMempoolDynamicSize(state.MempoolDynamicSize);
this.PerformanceCounter.AddHitCount(1);
this.logger.LogInformation("Transaction {txId} validated by mempool", tx.GetHash());
});
}
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -382,6 +382,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool
{
this.filterInventoryKnown.Add(trxHash);
}
this.logger.LogInformation("Received transaction {txId}. Transaction hex: '{txHex}'", trxHash, trx.ToHex());
this.logger.LogTrace("Added transaction ID '{0}' to known inventory filter.", trxHash);
var state = new MempoolValidationState(true);
......
......@@ -27,7 +27,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
......@@ -214,10 +214,8 @@ namespace Stratis.Bitcoin.Features.Miner
// transaction (which in most cases can be a no-op).
this.IncludeWitness = false; //IsWitnessEnabled(pindexPrev, chainparams.GetConsensus()) && fMineWitnessTx;
// add transactions from the mempool
int nPackagesSelected;
int nDescendantsUpdated;
this.AddTransactions(out nPackagesSelected, out nDescendantsUpdated);
// Add transactions from the mempool
this.AddTransactions(out int nPackagesSelected, out int nDescendantsUpdated);
this.LastBlockTx = this.BlockTx;
this.LastBlockSize = this.BlockSize;
......@@ -229,6 +227,9 @@ namespace Stratis.Bitcoin.Features.Miner
var coinviewRule = this.ConsensusManager.ConsensusRules.GetRule<CoinViewRule>();
this.coinbase.Outputs[0].Value = this.fees + coinviewRule.GetProofOfWorkReward(this.height);
this.BlockTemplate.TotalFee = this.fees;
// We need the fee details per transaction to be readily available in case we have to remove transactions from the block later.
this.BlockTemplate.FeeDetails = this.inBlock.Select(i => new { i.TransactionHash, i.Fee }).ToDictionary(d => d.TransactionHash, d => d.Fee);
int nSerializeSize = this.block.GetSerializedSize();
this.logger.LogDebug("Serialized size is {0} bytes, block weight is {1}, number of txs is {2}, tx fees are {3}, number of sigops is {4}.", nSerializeSize, coinviewRule.GetBlockWeight(this.block), this.BlockTx, this.fees, this.BlockSigOpsCost);
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -3,6 +3,7 @@ using System.Threading;
using System.Threading.Tasks;
using NBitcoin;
using Stratis.Bitcoin.Features.Miner.Staking;
using Stratis.Bitcoin.Mining;
namespace Stratis.Bitcoin.Features.Miner.Interfaces
{
......@@ -16,13 +17,13 @@ namespace Stratis.Bitcoin.Features.Miner.Interfaces
/// Creates a coinstake transaction with kernel that satisfies POS staking target.
/// </summary>
/// <param name="utxoStakeDescriptions">List of UTXOs that are available in the wallet for staking.</param>
/// <param name="block">Template of the block that we are trying to mine.</param>
/// <param name="blockTemplate">Template of the block that we are trying to stake.</param>
/// <param name="chainTip">Tip of the best chain.</param>
/// <param name="searchInterval">Length of an unexplored block time space in seconds. It only makes sense to look for a solution within this interval.</param>
/// <param name="fees">Transaction fees from the transactions included in the block if we mine it.</param>
/// <param name="coinstakeContext">Information about coinstake transaction and its private key that is to be filled when the kernel is found.</param>
/// <returns><c>true</c> if the function succeeds, <c>false</c> otherwise.</returns>
Task<bool> CreateCoinstakeAsync(List<UtxoStakeDescription> utxoStakeDescriptions, Block block, ChainedHeader chainTip, long searchInterval, long fees, CoinstakeContext coinstakeContext);
Task<bool> CreateCoinstakeAsync(List<UtxoStakeDescription> utxoStakeDescriptions, BlockTemplate blockTemplate, ChainedHeader chainTip, long searchInterval, long fees, CoinstakeContext coinstakeContext);
/// <summary>
/// Attempts to stake new blocks in a loop.
......
......@@ -59,7 +59,7 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
/// <inheritdoc/>
public override async Task<bool> CreateCoinstakeAsync(List<UtxoStakeDescription> utxoStakeDescriptions,
Block block, ChainedHeader chainTip, long searchInterval, long fees, CoinstakeContext coinstakeContext)
BlockTemplate blockTemplate, ChainedHeader chainTip, long searchInterval, long fees, CoinstakeContext coinstakeContext)
{
// Provides PrepareCoinStakeTransactions with fees amount
......@@ -103,6 +103,9 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
"Node staking with {0} ({1:0.00} % of the network weight {2}), est. time to find new block is {3}.",
new Money(ourWeight), ourPercent, new Money(this.networkWeight), TimeSpan.FromSeconds(expectedTime));
this.logger.LogInformation("Staking block with transactions: {txIds}",
blockTemplate.Block.Transactions.Select(p => p.GetHash()).ToList());
this.rpcGetStakingInfoModel.ResumeStaking(ourWeight, expectedTime);
long minimalAllowedTime = chainTip.Header.Time + 1;
......@@ -145,7 +148,7 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
workerContexts[workerIndex] = cwc;
workers[workerIndex] = Task.Run(() =>
this.CoinstakeWorker(cwc, chainTip, block, minimalAllowedTime, searchInterval));
this.CoinstakeWorker(cwc, chainTip, blockTemplate.Block, minimalAllowedTime, searchInterval));
}
await Task.WhenAll(workers).ConfigureAwait(false);
......@@ -157,6 +160,23 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
}
this.logger.LogTrace("Worker #{0} found the kernel.", workersResult.KernelFoundIndex);
// We have to make sure that we have no future timestamps in our transactions set.
// We ignore the coinbase (it gets its timestamp reset after the coinstake is created).
for (int i = blockTemplate.Block.Transactions.Count - 1; i >= 1; i--)
{
// We have not yet updated the header timestamp, so we use the coinstake timestamp directly here.
if (blockTemplate.Block.Transactions[i].Time <= coinstakeContext.CoinstakeTx.Time)
continue;
// Update the total fees, with the to-be-removed transaction taken into account.
fees -= blockTemplate.FeeDetails[blockTemplate.Block.Transactions[i].GetHash()].Satoshi;
this.logger.LogDebug("Removing transaction with timestamp {0} as it is greater than coinstake transaction timestamp {1}. New fee amount {2}.", blockTemplate.Block.Transactions[i].Time, coinstakeContext.CoinstakeTx.Time, fees);
blockTemplate.Block.Transactions.Remove(blockTemplate.Block.Transactions[i]);
}
// Input to coinstake transaction.
UtxoStakeDescription coinstakeInput = workersResult.KernelCoin;
......
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
......@@ -402,7 +402,7 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
this.rpcGetStakingInfoModel.NetStakeWeight = this.networkWeight;
// Trying to create coinstake that satisfies the difficulty target, put it into a block and sign the block.
if (await this.StakeAndSignBlockAsync(utxoStakeDescriptions, posBlock, chainTip, blockTemplate.TotalFee, coinstakeTimestamp).ConfigureAwait(false))
if (await this.StakeAndSignBlockAsync(utxoStakeDescriptions, blockTemplate, chainTip, blockTemplate.TotalFee, coinstakeTimestamp).ConfigureAwait(false))
{
this.logger.LogTrace("New POS block created and signed successfully.");
await this.CheckStakeAsync(posBlock, chainTip).ConfigureAwait(false);
......@@ -505,13 +505,15 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
/// to be mined and signes it.
/// </summary>
/// <param name="utxoStakeDescriptions">List of UTXOs that are available in the wallet for staking.</param>
/// <param name="block">Template of the block that we are trying to mine.</param>
/// <param name="blockTemplate">Template of the block that we are trying to mine.</param>
/// <param name="chainTip">Tip of the best chain.</param>
/// <param name="fees">Transaction fees from the transactions included in the block if we mine it.</param>
/// <param name="coinstakeTimestamp">Maximal timestamp of the coinstake transaction. The actual timestamp can be lower, but not higher.</param>
/// <returns><c>true</c> if the function succeeds, <c>false</c> otherwise.</returns>
private async Task<bool> StakeAndSignBlockAsync(List<UtxoStakeDescription> utxoStakeDescriptions, PosBlock block, ChainedHeader chainTip, long fees, uint coinstakeTimestamp)
private async Task<bool> StakeAndSignBlockAsync(List<UtxoStakeDescription> utxoStakeDescriptions, BlockTemplate blockTemplate, ChainedHeader chainTip, long fees, uint coinstakeTimestamp)
{
var block = blockTemplate.Block as PosBlock;
// If we are trying to sign something except proof-of-stake block template.
if (!block.Transactions[0].Outputs[0].IsEmpty)
{
......@@ -526,8 +528,7 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
return true;
}
var coinstakeContext = new CoinstakeContext();
coinstakeContext.CoinstakeTx = this.network.CreateTransaction();
var coinstakeContext = new CoinstakeContext { CoinstakeTx = this.network.CreateTransaction() };
coinstakeContext.CoinstakeTx.Time = coinstakeTimestamp;
// Search to current coinstake time.
......@@ -539,26 +540,14 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
this.lastCoinStakeSearchTime = searchTime;
this.logger.LogTrace("Search interval set to {0}, last coinstake search timestamp set to {1}.", searchInterval, this.lastCoinStakeSearchTime);
if (await this.CreateCoinstakeAsync(utxoStakeDescriptions, block, chainTip, searchInterval, fees, coinstakeContext).ConfigureAwait(false))
if (await this.CreateCoinstakeAsync(utxoStakeDescriptions, blockTemplate, chainTip, searchInterval, fees, coinstakeContext).ConfigureAwait(false))
{
uint minTimestamp = chainTip.Header.Time + 1;
if (coinstakeContext.CoinstakeTx.Time >= minTimestamp)
{
// Make sure coinstake would meet timestamp protocol
// as it would be the same as the block timestamp.
// Make sure coinstake would meet timestamp protocol as it would be the same as the block timestamp.
block.Transactions[0].Time = block.Header.Time = coinstakeContext.CoinstakeTx.Time;
// We have to make sure that we have no future timestamps in
// our transactions set.
for (int i = block.Transactions.Count - 1; i >= 0; i--)
{
if (block.Transactions[i].Time > block.Header.Time)
{
this.logger.LogTrace("Removing transaction with timestamp {0} as it is greater than coinstake transaction timestamp {1}.", block.Transactions[i].Time, block.Header.Time);
block.Transactions.Remove(block.Transactions[i]);
}
}
block.Transactions.Insert(1, coinstakeContext.CoinstakeTx);
block.UpdateMerkleRoot();
......@@ -576,7 +565,7 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
}
/// <inheritdoc/>
public virtual async Task<bool> CreateCoinstakeAsync(List<UtxoStakeDescription> utxoStakeDescriptions, Block block, ChainedHeader chainTip, long searchInterval, long fees, CoinstakeContext coinstakeContext)
public virtual async Task<bool> CreateCoinstakeAsync(List<UtxoStakeDescription> utxoStakeDescriptions, BlockTemplate blockTemplate, ChainedHeader chainTip, long searchInterval, long fees, CoinstakeContext coinstakeContext)
{
coinstakeContext.CoinstakeTx.Inputs.Clear();
coinstakeContext.CoinstakeTx.Outputs.Clear();
......@@ -647,7 +636,7 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
coinIndex += stakingUtxoCount;
workerContexts[workerIndex] = cwc;
workers[workerIndex] = Task.Run(() => this.CoinstakeWorker(cwc, chainTip, block, minimalAllowedTime, searchInterval));
workers[workerIndex] = Task.Run(() => this.CoinstakeWorker(cwc, chainTip, blockTemplate.Block, minimalAllowedTime, searchInterval));
}
await Task.WhenAll(workers).ConfigureAwait(false);
......@@ -660,6 +649,21 @@ namespace Stratis.Bitcoin.Features.Miner.Staking
this.logger.LogTrace("Worker #{0} found the kernel.", workersResult.KernelFoundIndex);
// We have to make sure that we have no future timestamps in our transactions set.
// We ignore the coinbase (it gets its timestamp reset after the coinstake is created).
for (int i = blockTemplate.Block.Transactions.Count - 1; i >= 1; i--)
{
// We have not yet updated the header timestamp, so we use the coinstake timestamp directly here.
if (blockTemplate.Block.Transactions[i].Time <= coinstakeContext.CoinstakeTx.Time)
continue;
// Update the total fees, with the to-be-removed transaction taken into account.
fees -= blockTemplate.FeeDetails[blockTemplate.Block.Transactions[i].GetHash()].Satoshi;
this.logger.LogDebug("Removing transaction with timestamp {0} as it is greater than coinstake transaction timestamp {1}. New fee amount {2}.", blockTemplate.Block.Transactions[i].Time, coinstakeContext.CoinstakeTx.Time, fees);
blockTemplate.Block.Transactions.Remove(blockTemplate.Block.Transactions[i]);
}
// Get reward for newly created block.
long reward = fees + this.consensusManager.ConsensusRules.GetRule<PosCoinviewRule>().GetProofOfStakeReward(chainTip.Height + 1);
if (reward <= 0)
......
......@@ -25,7 +25,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NBitcoin\NBitcoin.csproj" />
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -25,7 +25,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -19,7 +19,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -32,7 +32,7 @@
<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="2.1.1" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -32,7 +32,7 @@
<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="2.1.1" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -26,7 +26,7 @@
<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="2.1.1" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
using NBitcoin;
using System.Collections.Generic;
using NBitcoin;
namespace Stratis.Bitcoin.Mining
{
......@@ -7,6 +8,8 @@ namespace Stratis.Bitcoin.Mining
public Block Block { get; set; }
public Money TotalFee { get; set; }
public Dictionary<uint256, Money> FeeDetails { get; set; }
public BlockTemplate(Network network)
{
......
......@@ -39,7 +39,7 @@
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Tracer.Fody" Version="2.2.0" />
<PackageReference Include="Tracer.Fody" Version="3.1.0" />
</ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Weavers GenerateXsd="false">
</Weavers>
\ No newline at end of file
......@@ -2,39 +2,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: seed1
name: dst-client
labels:
app: seed1
app: dst-client
namespace: prod
spec:
replicas: 3
revisionHistoryLimit: 2
replicas: 1
revisionHistoryLimit: 1
strategy:
type: Recreate
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: seed
app: dst-client
template:
metadata:
labels:
app: seed
app: dst-client
spec:
containers:
- name: seed1
- name: dst-client
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll"]
ports:
- name: seed-api
containerPort: 56833
- name: seed-svc
containerPort: 56864
- name: dst-client
containerPort: 5000
volumeMounts:
- name: pv-seed1
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
- name: pv-dst-client
mountPath: /root/.destreamnode/destream/DeStreamMain
- name: dst-client-config
mountPath: /root/.destreamnode/destream/DeStreamMain/destream.conf
subPath: destream.conf
nodeName: node3
volumes:
- name: pv-seed1
- name: pv-dst-client
persistentVolumeClaim:
claimName: pv-seed1-claim
\ No newline at end of file
claimName: pv-dst-client-claim
- name: dst-client-config
configMap:
name: destreamconf
......@@ -2,39 +2,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: node2
name: dst-client
labels:
app: node2
namespace: prod2
app: dst-client
namespace: prod
spec:
replicas: 1
revisionHistoryLimit: 2
revisionHistoryLimit: 1
strategy:
type: Recreate
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: node
app: dst-client
template:
metadata:
labels:
app: node
app: dst-client
spec:
containers:
- name: node2
- name: dst-client
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","-addnode=148.251.53.215","-addnode=144.76.219.71"]
args: ["DeStream.DeStreamD.dll"]
ports:
- name: node-api
containerPort: 56833
- name: node-svc
containerPort: 56864
- name: dst-client
containerPort: 5000
volumeMounts:
- name: pv-node2
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
- name: pv-dst-client
mountPath: /root/.destreamnode/destream/DeStreamMain
- name: dst-client-config
mountPath: /root/.destreamnode/destream/DeStreamMain/destream.conf
subPath: destream.conf
nodeName: node3
volumes:
- name: pv-node2
- name: pv-dst-client
persistentVolumeClaim:
claimName: pv-node2-claim
\ No newline at end of file
claimName: pv-dst-client-claim
- name: dst-client-config
configMap:
name: destreamconf
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node-scanner
labels:
app: node-scanner
namespace: prod
spec:
replicas: 1
revisionHistoryLimit: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: node-scanner
template:
metadata:
labels:
app: node-scanner
spec:
containers:
- name: node-scanner
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","IpRangeFiltering=false"]
ports:
- name: node-scanner
containerPort: 5000
volumeMounts:
- name: pv-node-scanner-prod
mountPath: /root/.destreamnode/destream/DeStreamMain
- name: node-scanner-config
mountPath: /root/.destreamnode/destream/DeStreamMain/destream.conf
subPath: destream.conf
nodeName: node1
volumes:
- name: pv-node-scanner-prod
persistentVolumeClaim:
claimName: pv-node-scanner-prod-claim
- name: node-scanner-config
configMap:
name: nakonodeconf
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node1
labels:
app: node1
namespace: prod1
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
app: node
template:
metadata:
labels:
app: node
spec:
containers:
- name: node1
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","-addnode=148.251.53.215","-addnode=144.76.219.71"]
ports:
- name: node-api
containerPort: 56833
- name: node-svc
containerPort: 56864
volumeMounts:
- name: pv-node1
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
volumes:
- name: pv-node1
persistentVolumeClaim:
claimName: pv-node1-claim
\ No newline at end of file
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node3
labels:
app: node3
namespace: prod3
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
app: node
template:
metadata:
labels:
app: node
spec:
containers:
- name: node3
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","-addnode=148.251.53.215","-addnode=144.76.219.71"]
ports:
- name: node-api
containerPort: 56833
- name: node-svc
containerPort: 56864
volumeMounts:
- name: pv-node3
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
volumes:
- name: pv-node3
persistentVolumeClaim:
claimName: pv-node3-claim
\ No newline at end of file
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node4
labels:
app: node4
namespace: prod4
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
app: node
template:
metadata:
labels:
app: node
spec:
containers:
- name: node4
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","-addnode=148.251.53.215","-addnode=144.76.219.71"]
ports:
- name: node-api
containerPort: 56833
- name: node-svc
containerPort: 56864
volumeMounts:
- name: pv-node4
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
volumes:
- name: pv-node4
persistentVolumeClaim:
claimName: pv-node4-claim
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node5
labels:
app: node5
namespace: prod5
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
app: node
template:
metadata:
labels:
app: node
spec:
containers:
- name: node5
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","-addnode=148.251.53.215","-addnode=144.76.219.71"]
ports:
- name: node-api
containerPort: 56833
- name: node-svc
containerPort: 56864
volumeMounts:
- name: pv-node5
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
volumes:
- name: pv-node5
persistentVolumeClaim:
claimName: pv-node5-claim
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node6
labels:
app: node6
namespace: prod6
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
app: node
template:
metadata:
labels:
app: node
spec:
containers:
- name: node6
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","-addnode=148.251.53.215","-addnode=144.76.219.71"]
ports:
- name: node-api
containerPort: 56833
- name: node-svc
containerPort: 56864
volumeMounts:
- name: pv-node6
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
volumes:
- name: pv-node6
persistentVolumeClaim:
claimName: pv-node6-claim
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node7
labels:
app: node7
namespace: prod7
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
app: node
template:
metadata:
labels:
app: node
spec:
containers:
- name: node7
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","-addnode=148.251.53.215","-addnode=144.76.219.71"]
ports:
- name: node-api
containerPort: 56833
- name: node-svc
containerPort: 56864
volumeMounts:
- name: pv-node7
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
volumes:
- name: pv-node7
persistentVolumeClaim:
claimName: pv-node7-claim
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node8
labels:
app: node8
namespace: prod8
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
app: node
template:
metadata:
labels:
app: node
spec:
containers:
- name: node8
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","-addnode=148.251.53.215","-addnode=144.76.219.71"]
ports:
- name: node-api
containerPort: 56833
- name: node-svc
containerPort: 56864
volumeMounts:
- name: pv-node8
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
volumes:
- name: pv-node8
persistentVolumeClaim:
claimName: pv-node8-claim
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node9
labels:
app: node9
namespace: prod9
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
app: node
template:
metadata:
labels:
app: node
spec:
containers:
- name: node9
image: _IMAGE_NAME_:_VERSION_
command: ["dotnet"]
args: ["DeStream.DeStreamD.dll","-addnode=148.251.53.215","-addnode=144.76.219.71"]
ports:
- name: node-api
containerPort: 56833
- name: node-svc
containerPort: 56864
volumeMounts:
- name: pv-node9
mountPath: "/root/.destreamnode"
imagePullSecrets:
- name: registrypullsecret
volumes:
- name: pv-node9
persistentVolumeClaim:
claimName: pv-node9-claim
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment