Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Blockcore.Networks.Bitcoin\Blockcore.Networks.Bitcoin.csproj" />
<ProjectReference Include="..\NBitcoin\NBitcoin.csproj" />
<ProjectReference Include="..\Blockcore.Features.Api\Blockcore.Features.Api.csproj" />
<ProjectReference Include="..\Blockcore.Features.RPC\Blockcore.Features.RPC.csproj" />
<ProjectReference Include="..\Blockcore.Networks\Blockcore.Networks.csproj" />
<ProjectReference Include="..\Blockcore\Blockcore.csproj" />
</ItemGroup>

Expand Down
11 changes: 2 additions & 9 deletions src/Blockcore.Cli/Program.cs → src/Bitcoin.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Blockcore.Cli
namespace Bitcoin.Cli
{
public class Program
{
Expand Down Expand Up @@ -108,14 +108,7 @@ public static void Main(string[] args)
// Determine API port.
NetworksSelector networksSelector = null;

if (networkName.Contains("stratis"))
{
networksSelector = Networks.Networks.Stratis;
}
else
{
networksSelector = Networks.Networks.Bitcoin;
}
networksSelector = Blockcore.Networks.Bitcoin.Networks.Bitcoin;

// API calls require both the contoller name and the method name separated by "/".
// If this is not an API call then assume it is an RPC call.
Expand Down
2 changes: 1 addition & 1 deletion src/Bitcoin/BitcoinD.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Blockcore.Networks.Bitcoin\Blockcore.Networks.Bitcoin.csproj" />
<ProjectReference Include="..\NBitcoin\NBitcoin.csproj" />
<ProjectReference Include="..\Blockcore.Features.Api\Blockcore.Features.Api.csproj" />
<ProjectReference Include="..\Blockcore.Features.BlockStore\Blockcore.Features.BlockStore.csproj" />
<ProjectReference Include="..\Blockcore.Features.Consensus\Blockcore.Features.Consensus.csproj" />
<ProjectReference Include="..\Blockcore.Features.MemoryPool\Blockcore.Features.MemoryPool.csproj" />
<ProjectReference Include="..\Blockcore.Features.Miner\Blockcore.Features.Miner.csproj" />
<ProjectReference Include="..\Blockcore.Features.RPC\Blockcore.Features.RPC.csproj" />
<ProjectReference Include="..\Blockcore.Networks\Blockcore.Networks.csproj" />
<ProjectReference Include="..\Blockcore\Blockcore.csproj" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion src/Bitcoin/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Blockcore.Features.RPC;
using Blockcore.Features.Wallet;
using Blockcore.Networks;
using Blockcore.Networks.Bitcoin;
using Blockcore.Utilities;

namespace BitcoinD
Expand Down Expand Up @@ -43,4 +44,4 @@ public static async Task Main(string[] args)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
using Blockcore.Controllers.Models;
using Blockcore.Features.BlockStore.AddressIndexing;
using Blockcore.Networks;
using Blockcore.Networks.Bitcoin;
using Blockcore.Networks.Stratis;
using Blockcore.Primitives;
using Blockcore.Tests.Common;
using Blockcore.Utilities;
Expand Down Expand Up @@ -378,4 +380,4 @@ public void MaxReorgIsCalculatedProperly()
Assert.Equal(maxReorgStratis, (int)stratis.Consensus.MaxReorgLength);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Blockcore.Networks.Bitcoin\Blockcore.Networks.Bitcoin.csproj" />
<ProjectReference Include="..\Blockcore.Networks.Stratis\Blockcore.Networks.Stratis.csproj" />
<ProjectReference Include="..\NBitcoin\NBitcoin.csproj" />
<ProjectReference Include="..\Blockcore.Features.BlockStore\Blockcore.Features.BlockStore.csproj" />
<ProjectReference Include="..\Blockcore.Features.Consensus\Blockcore.Features.Consensus.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Blockcore.Configuration;
using Blockcore.Features.BlockStore.Pruning;
using Blockcore.Networks;
using Blockcore.Networks.Stratis;
using Blockcore.Tests.Common.Logging;
using Blockcore.Utilities;
using Xunit;
Expand Down Expand Up @@ -118,4 +119,4 @@ public void PruneRepository_PruneAndCompact_OnShutDown()
Assert.Null(blockRepository.GetBlock(chainedHeaderTip.GetAncestor(29).HashBlock));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Blockcore.Configuration;
using Blockcore.Features.BlockStore.Pruning;
using Blockcore.Networks;
using Blockcore.Networks.Stratis;
using Blockcore.Tests.Common.Logging;
using Blockcore.Utilities;
using Moq;
Expand Down Expand Up @@ -215,4 +216,4 @@ public void PruneService_Triggered_MidChain_Respect_AmountOfBlocksToKeep()
Assert.Equal(25, service.PrunedUpToHeaderTip.Height);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Blockcore.Networks.Bitcoin\Blockcore.Networks.Bitcoin.csproj" />
<ProjectReference Include="..\Blockcore.Networks.Stratis\Blockcore.Networks.Stratis.csproj" />
<ProjectReference Include="..\NBitcoin\NBitcoin.csproj" />
<ProjectReference Include="..\Blockcore.Features.ColdStaking\Blockcore.Features.ColdStaking.csproj" />
<ProjectReference Include="..\Blockcore.Features.Wallet\Blockcore.Features.Wallet.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
using Blockcore.Features.MemoryPool.Rules;
using Blockcore.Features.Wallet;
using Blockcore.Features.Wallet.Interfaces;
using Blockcore.Networks.Deployments;
using Blockcore.Networks.Policies;
using Blockcore.Networks.Stratis.Deployments;
using Blockcore.Networks.Stratis.Policies;
using Blockcore.Signals;
using Blockcore.Tests.Common;
using Blockcore.Utilities;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Blockcore.Networks.Bitcoin\Blockcore.Networks.Bitcoin.csproj" />
<ProjectReference Include="..\Blockcore.Networks.Stratis\Blockcore.Networks.Stratis.csproj" />
<ProjectReference Include="..\NBitcoin\NBitcoin.csproj" />
<ProjectReference Include="..\Blockcore.Features.Consensus\Blockcore.Features.Consensus.csproj" />
<ProjectReference Include="..\Blockcore.Features.Miner\Blockcore.Features.Miner.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Blockcore.Features.Consensus.CoinViews.Coindb;
using Blockcore.Features.Consensus.ProvenBlockHeaders;
using Blockcore.Networks;
using Blockcore.Networks.Stratis;
using Blockcore.Tests.Common;
using Blockcore.Utilities;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -51,9 +52,9 @@ public CoinviewTests()
this.stakeChainStore = new StakeChainStore(this.network, this.chainIndexer, (IStakdb)this.coindb, this.loggerFactory);
this.stakeChainStore.Load();

this.rewindDataIndexCache = new RewindDataIndexCache(this.dateTimeProvider, this.network, new FinalizedBlockInfoRepository(new HashHeightPair()) , new Checkpoints());
this.rewindDataIndexCache = new RewindDataIndexCache(this.dateTimeProvider, this.network, new FinalizedBlockInfoRepository(new HashHeightPair()), new Checkpoints());

this.cachedCoinView = new CachedCoinView(this.network, new Checkpoints(), this.coindb, this.dateTimeProvider, this.loggerFactory, this.nodeStats, new ConsensusSettings(new NodeSettings(this.network)) , this.stakeChainStore, this.rewindDataIndexCache);
this.cachedCoinView = new CachedCoinView(this.network, new Checkpoints(), this.coindb, this.dateTimeProvider, this.loggerFactory, this.nodeStats, new ConsensusSettings(new NodeSettings(this.network)), this.stakeChainStore, this.rewindDataIndexCache);

this.rewindDataIndexCache.Initialize(this.chainIndexer.Height, this.cachedCoinView);

Expand Down Expand Up @@ -103,7 +104,7 @@ public async Task TestRewindAsync()
Assert.Equal(txPoints.Count, response.UnspentOutputs.Count);
var toSpend = new List<UnspentOutput>();
foreach (OutPoint outPointToSpend in txPointsToSpend)
{
{
response.UnspentOutputs[outPointToSpend].Spend();
toSpend.Add(response.UnspentOutputs[outPointToSpend]);
}
Expand Down Expand Up @@ -214,4 +215,4 @@ private void Shuffle<T>(IList<T> list)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Blockcore.Features.Consensus.CoinViews;
using Blockcore.Features.Consensus.ProvenBlockHeaders;
using Blockcore.Networks;
using Blockcore.Networks.Stratis;
using Blockcore.Tests.Common;
using Blockcore.Tests.Common.Logging;
using Blockcore.Utilities;
Expand All @@ -23,7 +24,6 @@ public RewindDataIndexCacheTest() : base(new StratisTest())
// override max reorg to 10
Type consensusType = typeof(NBitcoin.Consensus);
consensusType.GetProperty("MaxReorgLength").SetValue(this.Network.Consensus, (uint)10);

}

[Fact]
Expand Down Expand Up @@ -129,7 +129,6 @@ public void RewindDataIndex_Remove()
this.CheckCache(items, 19, 9);
}


private void CheckCache(ConcurrentDictionary<OutPoint, int> items, int tip, int bottom)
{
foreach (KeyValuePair<OutPoint, int> keyValuePair in items)
Expand All @@ -152,4 +151,4 @@ private void SetupMockCoinView(Mock<ICoinView> coinViewMock)
});
}
}
}
}
1 change: 1 addition & 0 deletions src/Blockcore.Features.Consensus.Tests/PeerBanningTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Blockcore.Connection;
using Blockcore.Consensus;
using Blockcore.Networks;
using Blockcore.Networks.Stratis;
using Blockcore.P2P;
using Blockcore.P2P.Peer;
using Blockcore.Tests.Common;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Blockcore.Features.Consensus.ProvenBlockHeaders;
using Blockcore.Interfaces;
using Blockcore.Networks;
using Blockcore.Networks.Stratis;
using Blockcore.Tests.Common;
using Blockcore.Tests.Common.Logging;
using Blockcore.Utilities;
Expand Down Expand Up @@ -74,7 +75,6 @@ public async Task AddToPending_Adds_To_CacheAsync()
outHeaderRepo.Should().BeNull();
}


[Fact]
public async Task AddToPending_Adds_To_Cache_Then_Save_To_DiskAsync()
{
Expand Down Expand Up @@ -468,4 +468,4 @@ private ProvenBlockHeaderStore SetupStore()
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Blockcore.Features.Consensus.Behaviors;
using Blockcore.Interfaces;
using Blockcore.Networks;
using Blockcore.Networks.Stratis;
using Blockcore.P2P.Peer;
using Blockcore.P2P.Protocol;
using Blockcore.P2P.Protocol.Payloads;
Expand Down Expand Up @@ -144,4 +145,4 @@ private bool VerifyHeaders(List<ProvenBlockHeader> fromVerify, List<ProvenBlockH
return true;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using Blockcore.Consensus;
using Blockcore.Features.Consensus.Rules.CommonRules;
using Blockcore.Networks.Bitcoin.Rules;
using Blockcore.Tests.Common;
using NBitcoin;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Blockcore.Features.Consensus.CoinViews;
using Blockcore.Features.Consensus.Rules;
using Blockcore.Features.Consensus.Rules.CommonRules;
using Blockcore.Features.Consensus.Rules.UtxosetRules;
using Blockcore.Interfaces;
using Blockcore.Tests.Common;
using Blockcore.Utilities;
Expand All @@ -25,7 +26,7 @@
namespace Blockcore.Features.Consensus.Tests.Rules.CommonRules
{
/// <summary>
/// Test cases related to the <see cref="PosCoinviewRule"/>.
/// Test cases related to the <see cref="CheckPosUtxosetRule"/>.
/// </summary>
public class PosCoinViewRuleTests : TestPosConsensusRulesUnitTestBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Blockcore.Consensus;
using Blockcore.Features.Consensus.Rules.CommonRules;
using Blockcore.Networks.Stratis.Rules;
using NBitcoin;
using Xunit;

Expand Down Expand Up @@ -87,4 +88,4 @@ public void RunAsync_HeaderTimestampBelowFutureDriftLimit_WithReducedDrift_DoesN
this.consensusRules.RegisterRule<StratisBugFixPosFutureDriftRule>().Run(this.ruleContext);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Threading.Tasks;
using Blockcore.Consensus;
using Blockcore.Features.Consensus.Rules.CommonRules;
using Blockcore.Networks.Stratis.Rules;
using NBitcoin;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Blockcore.Features.Consensus.CoinViews;
using Blockcore.Features.Consensus.Rules;
using Blockcore.Features.Consensus.Rules.CommonRules;
using Blockcore.Features.Consensus.Rules.UtxosetRules;
using Blockcore.Signals;
using Blockcore.Tests.Common;
using Blockcore.Utilities;
Expand All @@ -34,12 +35,12 @@ public class PowCoinViewRuleTests
private RuleContext ruleContext;
private UnspentOutputSet coinView;
private Transaction transactionWithCoinbaseFromPreviousBlock;
private readonly CoinViewRule rule;
private readonly CheckUtxosetRule rule;

public PowCoinViewRuleTests()
{
this.network = KnownNetworks.RegTest;
this.rule = new PowCoinviewRule();
this.rule = new CheckPowUtxosetPowRule();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
using System.Collections.Generic;
using Blockcore.Features.Consensus.Rules.CommonRules;
using Blockcore.Features.Consensus.Rules.ProvenHeaderRules;
using Blockcore.Features.Consensus.Rules.UtxosetRules;
using Blockcore.Networks;
using Blockcore.Networks.Bitcoin;
using Blockcore.Networks.Bitcoin.Rules;
using Blockcore.Networks.Stratis;
using Blockcore.Networks.Stratis.Rules;
using FluentAssertions;
using NBitcoin;
using Xunit;
Expand Down Expand Up @@ -49,12 +54,11 @@ public void BitcoinConsensusRulesRegistrationTest()
fullValidationRules.Count.Should().Be(6);

fullValidationRules[0].FullName.Should().Be(typeof(SetActivationDeploymentsFullValidationRule).FullName);
fullValidationRules[1].FullName.Should().Be(typeof(FetchCoinviewRule).FullName);
fullValidationRules[1].FullName.Should().Be(typeof(FetchUtxosetRule).FullName);
fullValidationRules[2].FullName.Should().Be(typeof(TransactionDuplicationActivationRule).FullName);
fullValidationRules[3].FullName.Should().Be(typeof(PowCoinviewRule).FullName);
fullValidationRules[4].FullName.Should().Be(typeof(PushCoinviewRule).FullName);
fullValidationRules[5].FullName.Should().Be(typeof(FlushCoinviewRule).FullName);

fullValidationRules[3].FullName.Should().Be(typeof(CheckPowUtxosetPowRule).FullName);
fullValidationRules[4].FullName.Should().Be(typeof(PushUtxosetRule).FullName);
fullValidationRules[5].FullName.Should().Be(typeof(FlushUtxosetRule).FullName);
}

[Fact]
Expand Down Expand Up @@ -105,9 +109,9 @@ public void StratisConsensusRulesRegistrationTest()
fullValidationRules[1].FullName.Should().Be(typeof(CheckDifficultyHybridRule).FullName);
fullValidationRules[2].FullName.Should().Be(typeof(LoadCoinviewRule).FullName);
fullValidationRules[3].FullName.Should().Be(typeof(TransactionDuplicationActivationRule).FullName);
fullValidationRules[4].FullName.Should().Be(typeof(PosCoinviewRule).FullName);
fullValidationRules[4].FullName.Should().Be(typeof(CheckPosUtxosetRule).FullName);
fullValidationRules[5].FullName.Should().Be(typeof(PosColdStakingRule).FullName);
fullValidationRules[6].FullName.Should().Be(typeof(SaveCoinviewRule).FullName);
}
}
}
}
Loading