Commit 71f875bd authored by khvostenko's avatar khvostenko

"stratis" substituted with "destream" in code

parent a2ce77fa
......@@ -65,7 +65,7 @@ namespace DeStream.Bitcoin.Cli
builder.AppendLine();
builder.AppendLine("Command line arguments:");
builder.AppendLine();
builder.AppendLine("[network-name] Name of the network - e.g. \"stratis\", \"stratismain\", \"stratistest\", \"bitcoinmain\", \"bitcointest\".");
builder.AppendLine("[network-name] Name of the network - e.g. \"destream\", \"destreammain\", \"destreamtest\", \"bitcoinmain\", \"bitcointest\".");
builder.AppendLine("[options] Options for the CLI (optional) - e.g. -help, -rpcuser, see below.");
builder.AppendLine("[command] Name of RPC method or API <controller>/<method>.");
builder.AppendLine("[arguments] Argument by position (RPC) or Name = Value pairs (API) (optional).");
......@@ -79,8 +79,8 @@ namespace DeStream.Bitcoin.Cli
builder.AppendLine();
builder.AppendLine("Examples:");
builder.AppendLine();
builder.AppendLine("dotnet run stratis Wallet/history WalletName=testwallet - Lists all the historical transactions of the wallet called 'testwallet'.");
builder.AppendLine("dotnet run stratis getinfo -rpcuser=stratistestuser -rpcpassword=stratistestpassword -rpcconnect=127.0.0.3 -rpcport=26174 - Displays general information about the DeStream node on the 127.0.0.3:26174, authenticating with the RPC specified user.");
builder.AppendLine("dotnet run destream Wallet/history WalletName=testwallet - Lists all the historical transactions of the wallet called 'testwallet'.");
builder.AppendLine("dotnet run destream getinfo -rpcuser=destreamtestuser -rpcpassword=destreamtestpassword -rpcconnect=127.0.0.3 -rpcport=26174 - Displays general information about the DeStream node on the 127.0.0.3:26174, authenticating with the RPC specified user.");
builder.AppendLine("dotnet run bitcoin getbalance -rpcuser=btctestuser -rpcpassword=btctestpass - Displays the current balance of the opened wallet on the 127.0.0.1:8332 node, authenticating with the RPC specified user.");
Console.WriteLine(builder);
return;
......@@ -90,7 +90,7 @@ namespace DeStream.Bitcoin.Cli
int defaultRestApiPort = 0;
Network network = null;
if (networkName.Contains("stratis"))
if (networkName.Contains("destream"))
{
defaultRestApiPort = 37221;
network = Network.DeStreamMain;
......
......@@ -2,11 +2,11 @@
"profiles": {
"DeStream.CLI DeStream REST API": {
"commandName": "Project",
"commandLineArgs": "stratis Wallet/files"
"commandLineArgs": "destream Wallet/files"
},
"DeStream.CLI DeStream RPC": {
"commandName": "Project",
"commandLineArgs": "stratis -rpcuser=stratistestuser -rpcpassword=stratistestpass -rpcport=26174 getinfo"
"commandLineArgs": "destream -rpcuser=destreamtestuser -rpcpassword=destreamtestpass -rpcport=26174 getinfo"
},
"DeStream.CLI Bitcoin RPC": {
"commandName": "Project",
......
......@@ -70,7 +70,7 @@ namespace DeStream.Bitcoin.Features.Consensus
public class Checkpoints : ICheckpoints
{
/// <summary>List of selected checkpoints for STRAT mainnet.</summary>
private static Dictionary<int, CheckpointInfo> stratisMainnetCheckpoints = new Dictionary<int, CheckpointInfo>
private static Dictionary<int, CheckpointInfo> destreamMainnetCheckpoints = new Dictionary<int, CheckpointInfo>
{
{ 0, new CheckpointInfo(new uint256("0x0000066e91e46e5a264d42c89e1204963b2ee6be230b443e9159020539d972af"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
{ 2, new CheckpointInfo(new uint256("0xbca5936f638181e74a5f1e9999c95b0ce77da48c2688399e72bcc53a00c61eff"), new uint256("0x7d61c139a471821caa6b7635a4636e90afcfe5e195040aecbc1ad7d24924db1e")) }, // Premine
......@@ -92,7 +92,7 @@ namespace DeStream.Bitcoin.Features.Consensus
};
/// <summary>List of selected checkpoints for STRAT testnet.</summary>
private static Dictionary<int, CheckpointInfo> stratisTestnetCheckpoints = new Dictionary<int, CheckpointInfo>
private static Dictionary<int, CheckpointInfo> destreamTestnetCheckpoints = new Dictionary<int, CheckpointInfo>
{
{ 0, new CheckpointInfo(new uint256("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
{ 2, new CheckpointInfo(new uint256("0x56959b1c8498631fb0ca5fe7bd83319dccdc6ac003dccb3171f39f553ecfa2f2"), new uint256("0x13f4c27ca813aefe2d9018077f8efeb3766796b9144fcc4cd51803bf4376ab02")) },
......@@ -147,7 +147,7 @@ namespace DeStream.Bitcoin.Features.Consensus
/// <summary>
/// Initializes a new instance of the object.
/// </summary>
/// <param name="network">Specification of the network the node runs on - regtest/testnet/mainnet/stratis test/main.</param>
/// <param name="network">Specification of the network the node runs on - regtest/testnet/mainnet/destream test/main.</param>
/// <param name="settings">Consensus settings for node - used to see if checkpoints have been disabled or not.</param>
public Checkpoints(Network network, ConsensusSettings settings)
{
......@@ -158,8 +158,8 @@ namespace DeStream.Bitcoin.Features.Consensus
else if (network.Equals(Network.Main)) this.checkpoints = bitcoinMainnetCheckpoints;
else if (network.Equals(Network.TestNet)) this.checkpoints = bitcoinTestnetCheckpoints;
else if (network.Equals(Network.RegTest)) this.checkpoints = new Dictionary<int, CheckpointInfo>();
else if (network.Equals(Network.DeStreamMain)) this.checkpoints = stratisMainnetCheckpoints;
else if (network.Equals(Network.DeStreamTest)) this.checkpoints = stratisTestnetCheckpoints;
else if (network.Equals(Network.DeStreamMain)) this.checkpoints = destreamMainnetCheckpoints;
else if (network.Equals(Network.DeStreamTest)) this.checkpoints = destreamTestnetCheckpoints;
else this.checkpoints = new Dictionary<int, CheckpointInfo>();
}
......
......@@ -33,7 +33,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenLoad_AndStreamContainsIPAddressResourceRecord_AndIsIPv4_ThenEntryIsPopulated()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain domain = new Domain("destream.test.com");
IPAddressResourceRecord testResourceRecord = new IPAddressResourceRecord(domain, IPAddress.Parse("192.168.0.1"));
Question question = new Question(domain, RecordType.A);
......@@ -56,7 +56,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenLoad_AndStreamContainsIPAddressResourceRecord_AndIsIPv6_ThenEntryIsPopulated()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain domain = new Domain("destream.test.com");
IPAddressResourceRecord testResourceRecord = new IPAddressResourceRecord(domain, IPAddress.Parse("2001:db8:85a3:0:0:8a2e:370:7334"));
Question question = new Question(domain, RecordType.AAAA);
......@@ -79,8 +79,8 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenLoad_AndStreamContainsCanonicalNameResourceRecord_ThenEntryIsPopulated()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain cNameDomain = new Domain("www.stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain cNameDomain = new Domain("www.destream.test.com");
CanonicalNameResourceRecord testResourceRecord = new CanonicalNameResourceRecord(domain, cNameDomain);
Question question = new Question(domain, RecordType.CNAME);
......@@ -103,8 +103,8 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenLoad_AndStreamContainsMailExchangeResourceRecord_ThenEntryIsPopulated()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain exchangeDomain = new Domain("mail.stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain exchangeDomain = new Domain("mail.destream.test.com");
int preference = 10;
MailExchangeResourceRecord testResourceRecord = new MailExchangeResourceRecord(domain, preference, exchangeDomain);
......@@ -130,7 +130,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenLoad_AndStreamContainsNameServerResourceRecord_ThenEntryIsPopulated()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain nsDomain = new Domain("ns");
NameServerResourceRecord testResourceRecord = new NameServerResourceRecord(domain, nsDomain);
......@@ -155,8 +155,8 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenLoad_AndStreamContainsPointerResourceRecord_ThenEntryIsPopulated()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain nsDomain = new Domain("pointer.stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain nsDomain = new Domain("pointer.destream.test.com");
PointerResourceRecord testResourceRecord = new PointerResourceRecord(domain, nsDomain);
......@@ -180,7 +180,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenLoad_AndStreamContainsStartOfAuthorityResourceRecord_ThenEntryIsPopulated()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain masterDomain = new Domain("master.test.com");
Domain responsibleDomain = new Domain("responsible.test.com");
long serialNumber = 12121212;
......@@ -228,7 +228,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
// Arrange.
using (MemoryStream stream = new MemoryStream())
{
string domainName = "stratis.test.com";
string domainName = "destream.test.com";
DnsSeedMasterFile masterFile = new DnsSeedMasterFile();
IList<IResourceRecord> testResourceRecords = new List<IResourceRecord>()
......@@ -277,7 +277,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenSave_AndMasterListContainsIPAddressResourceRecord_AndIsIPv4_ThenEntryIsSaved()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain domain = new Domain("destream.test.com");
IPAddressResourceRecord testResourceRecord = new IPAddressResourceRecord(domain, IPAddress.Parse("192.168.0.1"));
DnsSeedMasterFile masterFile = new DnsSeedMasterFile();
......@@ -307,7 +307,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenSave_AndMasterListContainsIPAddressResourceRecord_AndIsIPv6_ThenEntryIsSaved()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain domain = new Domain("destream.test.com");
IPAddressResourceRecord testResourceRecord = new IPAddressResourceRecord(domain, IPAddress.Parse("2001:db8:85a3:0:0:8a2e:370:7334"));
DnsSeedMasterFile masterFile = new DnsSeedMasterFile();
......@@ -337,8 +337,8 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenSave_AndMasterListContainsCanonicalNameResourceRecord_ThenEntryIsSaved()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain cNameDomain = new Domain("www.stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain cNameDomain = new Domain("www.destream.test.com");
CanonicalNameResourceRecord testResourceRecord = new CanonicalNameResourceRecord(domain, cNameDomain);
DnsSeedMasterFile masterFile = new DnsSeedMasterFile();
......@@ -368,8 +368,8 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenSave_AndMasterListContainsMailExchangeResourceRecord_ThenEntryIsSaved()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain exchangeDomain = new Domain("mail.stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain exchangeDomain = new Domain("mail.destream.test.com");
int preference = 10;
MailExchangeResourceRecord testResourceRecord = new MailExchangeResourceRecord(domain, preference, exchangeDomain);
......@@ -400,7 +400,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenSave_AndMasterListContainsNameServerResourceRecord_ThenEntryIsSaved()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain nsDomain = new Domain("ns");
NameServerResourceRecord testResourceRecord = new NameServerResourceRecord(domain, nsDomain);
......@@ -431,8 +431,8 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenSave_AndMasterListContainsPointerResourceRecord_ThenEntryIsSaved()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain nsDomain = new Domain("pointer.stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain nsDomain = new Domain("pointer.destream.test.com");
PointerResourceRecord testResourceRecord = new PointerResourceRecord(domain, nsDomain);
DnsSeedMasterFile masterFile = new DnsSeedMasterFile();
......@@ -462,7 +462,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenSave_AndMasterListContainsStartOfAuthorityResourceRecord_ThenEntryIsSaved()
{
// Arrange
Domain domain = new Domain("stratis.test.com");
Domain domain = new Domain("destream.test.com");
Domain masterDomain = new Domain("master.test.com");
Domain responsibleDomain = new Domain("responsible.test.com");
long serialNumber = 12121212;
......@@ -514,7 +514,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
public void WhenSave_AndMasterListContainsEntries_ThenEntriesAreSaved()
{
// Arrange.
string domainName = "stratis.test.com";
string domainName = "destream.test.com";
IList<IResourceRecord> testResourceRecords = new List<IResourceRecord>()
{
......
......@@ -86,7 +86,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
IPeerAddressManager peerAddressManager = new Mock<IPeerAddressManager>().Object;
IDnsServer dnsServer = new Mock<IDnsServer>().Object;
DnsSettings dnsSettings = new Mock<DnsSettings>().Object;
dnsSettings.DnsHostName = "stratis.test.com";
dnsSettings.DnsHostName = "destream.test.com";
Action a = () => { new WhitelistManager(dateTimeProvider, loggerFactory, peerAddressManager, dnsServer, null, dnsSettings); };
......@@ -105,7 +105,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
IDnsServer dnsServer = new Mock<IDnsServer>().Object;
NodeSettings nodeSettings = NodeSettings.Default();
DnsSettings dnsSettings = new Mock<DnsSettings>().Object;
dnsSettings.DnsHostName = "stratis.test.com";
dnsSettings.DnsHostName = "destream.test.com";
Action a = () => { new WhitelistManager(dateTimeProvider, loggerFactory, peerAddressManager, dnsServer, null, dnsSettings); };
......@@ -169,7 +169,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
NodeSettings nodeSettings = NodeSettings.Default();
DnsSettings dnsSettings = new Mock<DnsSettings>().Object;
dnsSettings.DnsPeerBlacklistThresholdInSeconds = inactiveTimePeriod;
dnsSettings.DnsHostName = "stratis.test.com";
dnsSettings.DnsHostName = "destream.test.com";
ConnectionManagerSettings connectionSettings = new ConnectionManagerSettings();
connectionSettings.Load(nodeSettings);
......@@ -273,7 +273,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
NodeSettings nodeSettings = new NodeSettings(network, args:args);
DnsSettings dnsSettings = new Mock<DnsSettings>().Object;
dnsSettings.DnsPeerBlacklistThresholdInSeconds = inactiveTimePeriod;
dnsSettings.DnsHostName = "stratis.test.com";
dnsSettings.DnsHostName = "destream.test.com";
dnsSettings.DnsFullNode = false;
ConnectionManagerSettings connectionSettings = new ConnectionManagerSettings();
connectionSettings.Load(nodeSettings);
......@@ -362,7 +362,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
DnsSettings dnsSettings = new Mock<DnsSettings>().Object;
dnsSettings.DnsFullNode = true;
dnsSettings.DnsPeerBlacklistThresholdInSeconds = inactiveTimePeriod;
dnsSettings.DnsHostName = "stratis.test.com";
dnsSettings.DnsHostName = "destream.test.com";
ConnectionManagerSettings connectionSettings = new ConnectionManagerSettings();
connectionSettings.Load(nodeSettings);
......@@ -454,7 +454,7 @@ namespace DeStream.Bitcoin.Features.Dns.Tests
NodeSettings nodeSettings = NodeSettings.Default();
DnsSettings dnsSettings = new Mock<DnsSettings>().Object;
dnsSettings.DnsPeerBlacklistThresholdInSeconds = inactiveTimePeriod;
dnsSettings.DnsHostName = "stratis.test.com";
dnsSettings.DnsHostName = "destream.test.com";
ConnectionManagerSettings connectionSettings = new ConnectionManagerSettings();
connectionSettings.Load(nodeSettings);
......
......@@ -12,7 +12,7 @@ To install and run the DNS Server, you need
### Get the repository and its dependencies
```
git clone https://github.com/stratisproject/DeStreamBitcoinFullNode.git
git clone https://github.com/DeStream-dev/destream-blockchain.git
cd DeStreamBitcoinFullNode
git submodule update --init --recursive
```
......@@ -23,25 +23,25 @@ With this node, you can run the DNS Server in isolation or as a DeStream node wi
1. To run a <b>DeStream</b> node <b>only</b> on <b>MainNet</b>, do
```
cd DeStream.DeStreamDnsD
dotnet run -dnslistenport=5399 -dnshostname=dns.stratisplatform.com -dnsnameserver=ns1.dns.stratisplatform.com -dnsmailbox=admin@stratisplatform.com
dotnet run -dnslistenport=5399 -dnshostname=dns.destreamplatform.com -dnsnameserver=ns1.dns.destreamplatform.com -dnsmailbox=admin@destreamplatform.com
```
2. To run a <b>DeStream</b> node and <b>full node</b> on <b>MainNet</b>, do
```
cd DeStream.DeStreamDnsD
dotnet run -dnsfullnode -dnslistenport=5399 -dnshostname=dns.stratisplatform.com -dnsnameserver=ns1.dns.stratisplatform.com -dnsmailbox=admin@stratisplatform.com
dotnet run -dnsfullnode -dnslistenport=5399 -dnshostname=dns.destreamplatform.com -dnsnameserver=ns1.dns.destreamplatform.com -dnsmailbox=admin@destreamplatform.com
```
3. To run a <b>DeStream</b> node <b>only</b> on <b>TestNet</b>, do
```
cd DeStream.DeStreamDnsD
dotnet run -testnet -dnslistenport=5399 -dnshostname=dns.stratisplatform.com -dnsnameserver=ns1.dns.stratisplatform.com -dnsmailbox=admin@stratisplatform.com
dotnet run -testnet -dnslistenport=5399 -dnshostname=dns.destreamplatform.com -dnsnameserver=ns1.dns.destreamplatform.com -dnsmailbox=admin@destreamplatform.com
```
4. To run a <b>DeStream</b> node and <b>full node</b> on <b>TestNet</b>, do
```
cd DeStream.DeStreamDnsD
dotnet run -testnet -dnsfullnode -dnslistenport=5399 -dnshostname=dns.stratisplatform.com -dnsnameserver=ns1.dns.stratisplatform.com -dnsmailbox=admin@stratisplatform.com
dotnet run -testnet -dnsfullnode -dnslistenport=5399 -dnshostname=dns.destreamplatform.com -dnsnameserver=ns1.dns.destreamplatform.com -dnsmailbox=admin@destreamplatform.com
```
### Command-line arguments
......@@ -60,22 +60,22 @@ Given the following settings for the DeStream DNS Server:
| Argument | Value |
| ------------- | --------------------------------- |
| dnslistenport | 53 |
| dnshostname | stratisdns.stratisplatform.com |
| dnsnameserver | ns.stratisdns.stratisplatform.com |
| dnshostname | destreamdns.destreamplatform.com |
| dnsnameserver | ns.destreamdns.destreamplatform.com |
You should have NS and A record in your ISP DNS records for your DNS host domain:
| Type | Hostname | Data |
| -------- | --------------------------------- | --------------------------------- |
| NS | stratisdns.stratisplatform.com | ns.stratisdns.stratisplatform.com |
| A | ns.stratisdns.stratisplatform.com | 192.168.1.2 |
| NS | destreamdns.destreamplatform.com | ns.destreamdns.destreamplatform.com |
| A | ns.destreamdns.destreamplatform.com | 192.168.1.2 |
To verify the DeStream DNS Server is running with these settings run:
```
dig +qr -p 53 stratisdns.stratisplatform.com
dig +qr -p 53 destreamdns.destreamplatform.com
```
or
```
nslookup stratisdns.stratisplatform.com
nslookup destreamdns.destreamplatform.com
```
......@@ -6,9 +6,8 @@ using DeStream.Bitcoin.Features.Wallet.Interfaces;
namespace DeStream.Bitcoin.Features.LightWallet
{
/// <summary>
/// Light wallet fixed fee policy used for stratis network.
/// Light wallet fixed fee policy used for destream network.
/// </summary>
/// <seealso cref="https://github.com/stratisproject/stratisX/blob/master/src/wallet.cpp#L1437">DeStreamX fee calculation.</seealso>
public class LightWalletFixedFeePolicy : IWalletFeePolicy
{
/// <inheritdoc />
......
......@@ -39,7 +39,6 @@ namespace DeStream.Bitcoin.Features.Miner.Interfaces
/// <returns>Staking difficulty.</returns>
/// <remarks>
/// The actual idea behind the calculation is a mystery. It was simply ported from
/// <see cref="https://github.com/stratisproject/stratisX/blob/47851b7337f528f52ec20e86dca7dcead8191cf5/src/rpcblockchain.cpp#L16"/>.
/// </remarks>
double GetDifficulty(ChainedBlock block);
......@@ -68,7 +67,6 @@ namespace DeStream.Bitcoin.Features.Miner.Interfaces
/// presented on the network to generate each block.
/// <para>
/// The method was ported from
/// <see cref="https://github.com/stratisproject/stratisX/blob/47851b7337f528f52ec20e86dca7dcead8191cf5/src/rpcblockchain.cpp#L74"/>.
/// </para>
/// </remarks>
double GetNetworkWeight();
......
......@@ -181,7 +181,6 @@ namespace DeStream.Bitcoin.Features.Miner
/// <summary><c>true</c> if coinstake transaction splits the coin and generates extra UTXO
/// to prevent halting chain; <c>false</c> to disable coinstake splitting.</summary>
/// <remarks>TODO: It should be configurable option, not constant. <see cref="https://github.com/stratisproject/DeStreamBitcoinFullNode/issues/550"/></remarks>
public const bool CoinstakeSplitEnabled = true;
/// <summary> If <see cref="CoinstakeSplitEnabled"/> is set, the coinstake will be split if
......
......@@ -615,7 +615,7 @@ namespace DeStream.Bitcoin.Features.Wallet.Tests
string walletFileExtension = "wallet.json";
string testWalletFileName = Path.ChangeExtension("myWallet", walletFileExtension);
string testWalletPath = Path.Combine(AppContext.BaseDirectory, "stratisnode", testWalletFileName);
string testWalletPath = Path.Combine(AppContext.BaseDirectory, "destreamnode", testWalletFileName);
string folder = Path.GetDirectoryName(testWalletPath);
string[] files = new string[] { testWalletFileName };
mockWalletWrapper.Setup(w => w.GetWalletsFiles()).Returns((folder, files));
......
......@@ -35,9 +35,9 @@ namespace DeStream.Bitcoin.Features.Wallet.Tests
public void GetAllTransactionsByCoinTypeReturnsTransactionsFromWalletByCoinType()
{
var wallet = new Wallet();
var stratisAccountRoot = CreateAccountRootWithHdAccountHavingAddresses("DeStreamAccount", CoinType.DeStream);
var destreamAccountRoot = CreateAccountRootWithHdAccountHavingAddresses("DeStreamAccount", CoinType.DeStream);
var bitcoinAccountRoot = CreateAccountRootWithHdAccountHavingAddresses("BitcoinAccount", CoinType.Bitcoin);
var stratisAccountRoot2 = CreateAccountRootWithHdAccountHavingAddresses("DeStreamAccount2", CoinType.DeStream);
var destreamAccountRoot2 = CreateAccountRootWithHdAccountHavingAddresses("DeStreamAccount2", CoinType.DeStream);
var transaction1 = CreateTransaction(new uint256(1), new Money(15000), 1);
var transaction2 = CreateTransaction(new uint256(2), new Money(91209), 1);
......@@ -46,16 +46,16 @@ namespace DeStream.Bitcoin.Features.Wallet.Tests
var transaction5 = CreateTransaction(new uint256(5), new Money(52387), 1);
var transaction6 = CreateTransaction(new uint256(6), new Money(879873), 1);
stratisAccountRoot.Accounts.ElementAt(0).InternalAddresses.ElementAt(0).Transactions.Add(transaction1);
stratisAccountRoot.Accounts.ElementAt(0).ExternalAddresses.ElementAt(0).Transactions.Add(transaction2);
destreamAccountRoot.Accounts.ElementAt(0).InternalAddresses.ElementAt(0).Transactions.Add(transaction1);
destreamAccountRoot.Accounts.ElementAt(0).ExternalAddresses.ElementAt(0).Transactions.Add(transaction2);
bitcoinAccountRoot.Accounts.ElementAt(0).InternalAddresses.ElementAt(0).Transactions.Add(transaction3);
bitcoinAccountRoot.Accounts.ElementAt(0).ExternalAddresses.ElementAt(0).Transactions.Add(transaction4);
stratisAccountRoot2.Accounts.ElementAt(0).InternalAddresses.ElementAt(0).Transactions.Add(transaction5);
stratisAccountRoot2.Accounts.ElementAt(0).ExternalAddresses.ElementAt(0).Transactions.Add(transaction6);
destreamAccountRoot2.Accounts.ElementAt(0).InternalAddresses.ElementAt(0).Transactions.Add(transaction5);
destreamAccountRoot2.Accounts.ElementAt(0).ExternalAddresses.ElementAt(0).Transactions.Add(transaction6);
wallet.AccountsRoot.Add(stratisAccountRoot);
wallet.AccountsRoot.Add(destreamAccountRoot);
wallet.AccountsRoot.Add(bitcoinAccountRoot);
wallet.AccountsRoot.Add(stratisAccountRoot2);
wallet.AccountsRoot.Add(destreamAccountRoot2);
var result = wallet.GetAllTransactionsByCoinType(CoinType.DeStream).ToList();
......@@ -99,20 +99,20 @@ namespace DeStream.Bitcoin.Features.Wallet.Tests
public void GetAllPubKeysByCoinTypeReturnsPubkeysFromWalletByCoinType()
{
var wallet = new Wallet();
var stratisAccountRoot = CreateAccountRootWithHdAccountHavingAddresses("DeStreamAccount", CoinType.DeStream);
var destreamAccountRoot = CreateAccountRootWithHdAccountHavingAddresses("DeStreamAccount", CoinType.DeStream);
var bitcoinAccountRoot = CreateAccountRootWithHdAccountHavingAddresses("BitcoinAccount", CoinType.Bitcoin);
var stratisAccountRoot2 = CreateAccountRootWithHdAccountHavingAddresses("DeStreamAccount2", CoinType.DeStream);
wallet.AccountsRoot.Add(stratisAccountRoot);
var destreamAccountRoot2 = CreateAccountRootWithHdAccountHavingAddresses("DeStreamAccount2", CoinType.DeStream);
wallet.AccountsRoot.Add(destreamAccountRoot);
wallet.AccountsRoot.Add(bitcoinAccountRoot);
wallet.AccountsRoot.Add(stratisAccountRoot2);
wallet.AccountsRoot.Add(destreamAccountRoot2);
var result = wallet.GetAllPubKeysByCoinType(CoinType.DeStream).ToList();
Assert.Equal(4, result.Count);
Assert.Equal(stratisAccountRoot.Accounts.ElementAt(0).ExternalAddresses.ElementAt(0).ScriptPubKey, result[0]);
Assert.Equal(stratisAccountRoot2.Accounts.ElementAt(0).ExternalAddresses.ElementAt(0).ScriptPubKey, result[1]);
Assert.Equal(stratisAccountRoot.Accounts.ElementAt(0).InternalAddresses.ElementAt(0).ScriptPubKey, result[2]);
Assert.Equal(stratisAccountRoot2.Accounts.ElementAt(0).InternalAddresses.ElementAt(0).ScriptPubKey, result[3]);
Assert.Equal(destreamAccountRoot.Accounts.ElementAt(0).ExternalAddresses.ElementAt(0).ScriptPubKey, result[0]);
Assert.Equal(destreamAccountRoot2.Accounts.ElementAt(0).ExternalAddresses.ElementAt(0).ScriptPubKey, result[1]);
Assert.Equal(destreamAccountRoot.Accounts.ElementAt(0).InternalAddresses.ElementAt(0).ScriptPubKey, result[2]);
Assert.Equal(destreamAccountRoot2.Accounts.ElementAt(0).InternalAddresses.ElementAt(0).ScriptPubKey, result[3]);
}
[Fact]
......
......@@ -12,7 +12,6 @@ namespace DeStream.Bitcoin.Features.Wallet.Helpers
/// This specific comparer has been made to filter out duplicate payment listings in the case of a transaction with multiple inputs.
/// This causes multiple items inside the wallet data that all have the same amount, transaction/spending id and payment details.
/// However not all fields on this model are equal to each other so we only compare the ones we need.
/// See: https://github.com/stratisproject/Breeze/issues/175
/// </remarks>
public class SentTransactionItemModelComparer : IEqualityComparer<TransactionItemModel>
{
......
......@@ -65,7 +65,7 @@ namespace DeStream.Bitcoin.IntegrationTests
try
{
var fullNode = this.apiTestsFixture.stratisPowNode.FullNode;
var fullNode = this.apiTestsFixture.destreamPowNode.FullNode;
var apiURI = fullNode.NodeService<ApiSettings>().ApiUri;
using (client = new HttpClient())
......@@ -91,7 +91,7 @@ namespace DeStream.Bitcoin.IntegrationTests
{
try
{
var fullNode = this.apiTestsFixture.stratisStakeNode.FullNode;
var fullNode = this.apiTestsFixture.destreamStakeNode.FullNode;
var apiURI = fullNode.NodeService<ApiSettings>().ApiUri;
Assert.NotNull(fullNode.NodeService<IPosMinting>(true));
......@@ -134,7 +134,7 @@ namespace DeStream.Bitcoin.IntegrationTests
{
try
{
var fullNode = this.apiTestsFixture.stratisPowNode.FullNode;
var fullNode = this.apiTestsFixture.destreamPowNode.FullNode;
var apiURI = fullNode.NodeService<ApiSettings>().ApiUri;
using (client = new HttpClient())
......@@ -162,7 +162,7 @@ namespace DeStream.Bitcoin.IntegrationTests
{
try
{
var fullNode = this.apiTestsFixture.stratisPowNode.FullNode;
var fullNode = this.apiTestsFixture.destreamPowNode.FullNode;
var apiURI = fullNode.NodeService<ApiSettings>().ApiUri;
using (client = new HttpClient())
......@@ -186,8 +186,8 @@ namespace DeStream.Bitcoin.IntegrationTests
public class ApiTestsFixture : IDisposable
{
public NodeBuilder builder;
public CoreNode stratisPowNode;
public CoreNode stratisStakeNode;
public CoreNode destreamPowNode;
public CoreNode destreamStakeNode;
private bool initialBlockSignature;
public ApiTestsFixture()
......@@ -197,7 +197,7 @@ namespace DeStream.Bitcoin.IntegrationTests
this.builder = NodeBuilder.Create();
this.stratisPowNode = this.builder.CreateDeStreamPowNode(false, fullNodeBuilder =>
this.destreamPowNode = this.builder.CreateDeStreamPowNode(false, fullNodeBuilder =>
{
fullNodeBuilder
.UsePowConsensus()
......@@ -210,17 +210,17 @@ namespace DeStream.Bitcoin.IntegrationTests
});
// start api on different ports
this.stratisPowNode.ConfigParameters.Add("apiuri", "http://localhost:37221");
this.destreamPowNode.ConfigParameters.Add("apiuri", "http://localhost:37221");
this.builder.StartAll();
// Move a wallet file to the right folder and restart the wallet manager to take it into account.
this.InitializeTestWallet(this.stratisPowNode.FullNode.DataFolder.WalletPath);
var walletManager = this.stratisPowNode.FullNode.NodeService<IWalletManager>() as WalletManager;
this.InitializeTestWallet(this.destreamPowNode.FullNode.DataFolder.WalletPath);
var walletManager = this.destreamPowNode.FullNode.NodeService<IWalletManager>() as WalletManager;
walletManager.Start();
Block.BlockSignature = true;
this.stratisStakeNode = this.builder.CreateDeStreamPosNode(false, fullNodeBuilder =>
this.destreamStakeNode = this.builder.CreateDeStreamPosNode(false, fullNodeBuilder =>
{
fullNodeBuilder
.UsePosConsensus()
......@@ -232,7 +232,7 @@ namespace DeStream.Bitcoin.IntegrationTests
.AddRPC();
});
this.stratisStakeNode.ConfigParameters.Add("apiuri", "http://localhost:37222");
this.destreamStakeNode.ConfigParameters.Add("apiuri", "http://localhost:37222");
this.builder.StartAll();
}
......
......@@ -8,7 +8,7 @@ namespace DeStream.Bitcoin.IntegrationTests.BlockStore
[Fact]
public void Attempt_to_spend_coin_earned_through_proof_of_work_BEFORE_coin_maturity_will_fail()
{
Given(a_sending_and_receiving_stratis_bitcoin_node_and_wallet);
Given(a_sending_and_receiving_destream_bitcoin_node_and_wallet);
And(a_block_is_mined_creating_spendable_coins);
And(more_blocks_mined_to_just_BEFORE_maturity_of_original_block);
When(spending_the_coins_from_original_block);
......@@ -18,7 +18,7 @@ namespace DeStream.Bitcoin.IntegrationTests.BlockStore
[Fact]
public void Attempt_to_spend_coin_earned_through_proof_of_work_AFTER_maturity_will_succeed()
{
Given(a_sending_and_receiving_stratis_bitcoin_node_and_wallet);
Given(a_sending_and_receiving_destream_bitcoin_node_and_wallet);
And(a_block_is_mined_creating_spendable_coins);
And(more_blocks_mined_to_just_AFTER_maturity_of_original_block);
When(spending_the_coins_from_original_block);
......
......@@ -40,7 +40,7 @@ namespace DeStream.Bitcoin.IntegrationTests.BlockStore
this.nodeBuilder.Dispose();
}
private void a_sending_and_receiving_stratis_bitcoin_node_and_wallet()
private void a_sending_and_receiving_destream_bitcoin_node_and_wallet()
{
this.sendingDeStreamBitcoinNode = this.nodeBuilder.CreateDeStreamPowNode();
this.receivingDeStreamBitcoinNode = this.nodeBuilder.CreateDeStreamPowNode();
......
......@@ -148,40 +148,40 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var stratisNode1 = builder.CreateDeStreamPowNode();
var stratisNode2 = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
var destreamNode1 = builder.CreateDeStreamPowNode();
var destreamNode2 = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.NotInIBD();
stratisNode1.NotInIBD();
stratisNode2.NotInIBD();
destreamNodeSync.NotInIBD();
destreamNode1.NotInIBD();
destreamNode2.NotInIBD();
// generate blocks and wait for the downloader to pickup
stratisNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
stratisNodeSync.GenerateDeStreamWithMiner(10); // coinbase maturity = 10
destreamNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
destreamNodeSync.GenerateDeStreamWithMiner(10); // coinbase maturity = 10
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ChainBehaviorState.ConsensusTip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ChainBehaviorState.ConsensusTip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
// sync both nodes
stratisNode1.CreateRPCClient().AddNode(stratisNodeSync.Endpoint, true);
stratisNode2.CreateRPCClient().AddNode(stratisNodeSync.Endpoint, true);
TestHelper.WaitLoop(() => stratisNode1.CreateRPCClient().GetBestBlockHash() == stratisNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => stratisNode2.CreateRPCClient().GetBestBlockHash() == stratisNodeSync.CreateRPCClient().GetBestBlockHash());
destreamNode1.CreateRPCClient().AddNode(destreamNodeSync.Endpoint, true);
destreamNode2.CreateRPCClient().AddNode(destreamNodeSync.Endpoint, true);
TestHelper.WaitLoop(() => destreamNode1.CreateRPCClient().GetBestBlockHash() == destreamNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamNode2.CreateRPCClient().GetBestBlockHash() == destreamNodeSync.CreateRPCClient().GetBestBlockHash());
// set node2 to use inv (not headers)
stratisNode2.FullNode.ConnectionManager.ConnectedPeers.First().Behavior<BlockStoreBehavior>().PreferHeaders = false;
destreamNode2.FullNode.ConnectionManager.ConnectedPeers.First().Behavior<BlockStoreBehavior>().PreferHeaders = false;
// generate two new blocks
stratisNodeSync.GenerateDeStreamWithMiner(2);
destreamNodeSync.GenerateDeStreamWithMiner(2);
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.Chain.Tip.HashBlock == stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(stratisNodeSync.CreateRPCClient().GetBestBlockHash()).Result != null);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.Chain.Tip.HashBlock == destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(destreamNodeSync.CreateRPCClient().GetBestBlockHash()).Result != null);
// wait for the other nodes to pick up the newly generated blocks
TestHelper.WaitLoop(() => stratisNode1.CreateRPCClient().GetBestBlockHash() == stratisNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => stratisNode2.CreateRPCClient().GetBestBlockHash() == stratisNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamNode1.CreateRPCClient().GetBestBlockHash() == destreamNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamNode2.CreateRPCClient().GetBestBlockHash() == destreamNodeSync.CreateRPCClient().GetBestBlockHash());
}
}
......@@ -190,30 +190,30 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.NotInIBD();
destreamNodeSync.NotInIBD();
// generate blocks and wait for the downloader to pickup
stratisNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
destreamNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
stratisNodeSync.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisNodeSync));
destreamNodeSync.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamNodeSync));
// set the tip of best chain some blocks in the apst
stratisNodeSync.FullNode.Chain.SetTip(stratisNodeSync.FullNode.Chain.GetBlock(stratisNodeSync.FullNode.Chain.Height - 5));
destreamNodeSync.FullNode.Chain.SetTip(destreamNodeSync.FullNode.Chain.GetBlock(destreamNodeSync.FullNode.Chain.Height - 5));
// stop the node it will persist the chain with the reset tip
stratisNodeSync.FullNode.Dispose();
destreamNodeSync.FullNode.Dispose();
var newNodeInstance = builder.CloneDeStreamNode(stratisNodeSync);
var newNodeInstance = builder.CloneDeStreamNode(destreamNodeSync);
// load the node, this should hit the block store recover code
newNodeInstance.Start();
// check that store recovered to be the same as the best chain.
Assert.Equal(newNodeInstance.FullNode.Chain.Tip.HashBlock, newNodeInstance.FullNode.HighestPersistedBlock().HashBlock);
//TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisNodeSync));
//TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamNodeSync));
}
}
......@@ -222,51 +222,51 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var stratisNode1 = builder.CreateDeStreamPowNode();
var stratisNode2 = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
var destreamNode1 = builder.CreateDeStreamPowNode();
var destreamNode2 = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.NotInIBD();
stratisNode1.NotInIBD();
stratisNode2.NotInIBD();
destreamNodeSync.NotInIBD();
destreamNode1.NotInIBD();
destreamNode2.NotInIBD();
// generate blocks and wait for the downloader to pickup
stratisNode1.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
stratisNode2.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
destreamNode1.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
destreamNode2.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
// sync both nodes
stratisNodeSync.CreateRPCClient().AddNode(stratisNode1.Endpoint, true);
stratisNodeSync.CreateRPCClient().AddNode(stratisNode2.Endpoint, true);
destreamNodeSync.CreateRPCClient().AddNode(destreamNode1.Endpoint, true);
destreamNodeSync.CreateRPCClient().AddNode(destreamNode2.Endpoint, true);
stratisNode1.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => stratisNode1.FullNode.HighestPersistedBlock().Height == 10);
destreamNode1.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => destreamNode1.FullNode.HighestPersistedBlock().Height == 10);
TestHelper.WaitLoop(() => stratisNode1.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock);
TestHelper.WaitLoop(() => stratisNode2.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock);
TestHelper.WaitLoop(() => destreamNode1.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock);
TestHelper.WaitLoop(() => destreamNode2.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock);
// remove node 2
stratisNodeSync.CreateRPCClient().RemoveNode(stratisNode2.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(stratisNode2));
destreamNodeSync.CreateRPCClient().RemoveNode(destreamNode2.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(destreamNode2));
// mine some more with node 1
stratisNode1.GenerateDeStreamWithMiner(10);
destreamNode1.GenerateDeStreamWithMiner(10);
// wait for node 1 to sync
TestHelper.WaitLoop(() => stratisNode1.FullNode.HighestPersistedBlock().Height == 20);
TestHelper.WaitLoop(() => stratisNode1.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock);
TestHelper.WaitLoop(() => destreamNode1.FullNode.HighestPersistedBlock().Height == 20);
TestHelper.WaitLoop(() => destreamNode1.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock);
// remove node 1
stratisNodeSync.CreateRPCClient().RemoveNode(stratisNode1.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(stratisNode1));
destreamNodeSync.CreateRPCClient().RemoveNode(destreamNode1.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(destreamNode1));
// mine a higher chain with node2
stratisNode2.GenerateDeStreamWithMiner(20);
TestHelper.WaitLoop(() => stratisNode2.FullNode.HighestPersistedBlock().Height == 30);
destreamNode2.GenerateDeStreamWithMiner(20);
TestHelper.WaitLoop(() => destreamNode2.FullNode.HighestPersistedBlock().Height == 30);
// add node2
stratisNodeSync.CreateRPCClient().AddNode(stratisNode2.Endpoint, true);
destreamNodeSync.CreateRPCClient().AddNode(destreamNode2.Endpoint, true);
// node2 should be synced
TestHelper.WaitLoop(() => stratisNode2.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock);
TestHelper.WaitLoop(() => destreamNode2.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock);
}
}
......@@ -275,26 +275,26 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNode1 = builder.CreateDeStreamPowNode();
var stratisNode2 = builder.CreateDeStreamPowNode();
var destreamNode1 = builder.CreateDeStreamPowNode();
var destreamNode2 = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNode1.NotInIBD();
stratisNode2.NotInIBD();
destreamNode1.NotInIBD();
destreamNode2.NotInIBD();
// generate blocks and wait for the downloader to pickup
stratisNode1.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNode1.FullNode.Network));
stratisNode2.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNode2.FullNode.Network));
destreamNode1.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNode1.FullNode.Network));
destreamNode2.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNode2.FullNode.Network));
// sync both nodes
stratisNode1.CreateRPCClient().AddNode(stratisNode2.Endpoint, true);
stratisNode1.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => stratisNode1.FullNode.HighestPersistedBlock().Height == 10);
TestHelper.WaitLoop(() => stratisNode1.FullNode.HighestPersistedBlock().HashBlock == stratisNode2.FullNode.HighestPersistedBlock().HashBlock);
destreamNode1.CreateRPCClient().AddNode(destreamNode2.Endpoint, true);
destreamNode1.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => destreamNode1.FullNode.HighestPersistedBlock().Height == 10);
TestHelper.WaitLoop(() => destreamNode1.FullNode.HighestPersistedBlock().HashBlock == destreamNode2.FullNode.HighestPersistedBlock().HashBlock);
var bestBlock1 = stratisNode1.FullNode.BlockStoreManager().BlockRepository.GetAsync(stratisNode1.FullNode.Chain.Tip.HashBlock).Result;
var bestBlock1 = destreamNode1.FullNode.BlockStoreManager().BlockRepository.GetAsync(destreamNode1.FullNode.Chain.Tip.HashBlock).Result;
Assert.NotNull(bestBlock1);
// get the block coinbase trx
var trx = stratisNode2.FullNode.BlockStoreManager().BlockRepository.GetTrxAsync(bestBlock1.Transactions.First().GetHash()).Result;
var trx = destreamNode2.FullNode.BlockStoreManager().BlockRepository.GetTrxAsync(bestBlock1.Transactions.First().GetHash()).Result;
Assert.NotNull(trx);
Assert.Equal(bestBlock1.Transactions.First().GetHash(), trx.GetHash());
}
......
......@@ -172,38 +172,38 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNode = builder.CreateDeStreamPowNode();
var destreamNode = builder.CreateDeStreamPowNode();
var coreNode1 = builder.CreateNode();
var coreNode2 = builder.CreateNode();
builder.StartAll();
//Core1 discovers 10 blocks, sends to stratis
//Core1 discovers 10 blocks, sends to destream
var tip = coreNode1.FindBlock(10).Last();
stratisNode.CreateRPCClient().AddNode(coreNode1.Endpoint, true);
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNode1.CreateRPCClient().GetBestBlockHash());
stratisNode.CreateRPCClient().RemoveNode(coreNode1.Endpoint);
destreamNode.CreateRPCClient().AddNode(coreNode1.Endpoint, true);
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreNode1.CreateRPCClient().GetBestBlockHash());
destreamNode.CreateRPCClient().RemoveNode(coreNode1.Endpoint);
//Core2 discovers 20 blocks, sends to stratis
//Core2 discovers 20 blocks, sends to destream
tip = coreNode2.FindBlock(20).Last();
stratisNode.CreateRPCClient().AddNode(coreNode2.Endpoint, true);
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNode2.CreateRPCClient().GetBestBlockHash());
stratisNode.CreateRPCClient().RemoveNode(coreNode2.Endpoint);
((CachedCoinView)stratisNode.FullNode.CoinView()).FlushAsync().Wait();
destreamNode.CreateRPCClient().AddNode(coreNode2.Endpoint, true);
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreNode2.CreateRPCClient().GetBestBlockHash());
destreamNode.CreateRPCClient().RemoveNode(coreNode2.Endpoint);
((CachedCoinView)destreamNode.FullNode.CoinView()).FlushAsync().Wait();
//Core1 discovers 30 blocks, sends to stratis
//Core1 discovers 30 blocks, sends to destream
tip = coreNode1.FindBlock(30).Last();
stratisNode.CreateRPCClient().AddNode(coreNode1.Endpoint, true);
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNode1.CreateRPCClient().GetBestBlockHash());
stratisNode.CreateRPCClient().RemoveNode(coreNode1.Endpoint);
destreamNode.CreateRPCClient().AddNode(coreNode1.Endpoint, true);
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreNode1.CreateRPCClient().GetBestBlockHash());
destreamNode.CreateRPCClient().RemoveNode(coreNode1.Endpoint);
//Core2 discovers 50 blocks, sends to stratis
//Core2 discovers 50 blocks, sends to destream
tip = coreNode2.FindBlock(50).Last();
stratisNode.CreateRPCClient().AddNode(coreNode2.Endpoint, true);
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNode2.CreateRPCClient().GetBestBlockHash());
stratisNode.CreateRPCClient().RemoveNode(coreNode2.Endpoint);
((CachedCoinView)stratisNode.FullNode.CoinView()).FlushAsync().Wait();
destreamNode.CreateRPCClient().AddNode(coreNode2.Endpoint, true);
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreNode2.CreateRPCClient().GetBestBlockHash());
destreamNode.CreateRPCClient().RemoveNode(coreNode2.Endpoint);
((CachedCoinView)destreamNode.FullNode.CoinView()).FlushAsync().Wait();
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNode2.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreNode2.CreateRPCClient().GetBestBlockHash());
}
}
......
......@@ -73,7 +73,7 @@ namespace DeStream.Bitcoin.IntegrationTests.EnvironmentMockUpHelpers
this.networkPeerFactory = new NetworkPeerFactory(network, DateTimeProvider.Default, loggerFactory, new PayloadProvider().DiscoverPayloads(), new SelfEndpointTracker());
}
/// <summary>Get stratis full node if possible.</summary>
/// <summary>Get destream full node if possible.</summary>
public FullNode FullNode
{
get
......
......@@ -245,7 +245,7 @@ namespace DeStream.Bitcoin.IntegrationTests.EnvironmentMockUpHelpers
public CoreNode CreateDeStreamPosNode(bool start = false, Action<IFullNodeBuilder> callback = null)
{
string child = this.CreateNewEmptyFolder();
var node = new CoreNode(child, new DeStreamBitcoinPosRunner(callback), this, Network.RegTest, configfile: "stratis.conf");
var node = new CoreNode(child, new DeStreamBitcoinPosRunner(callback), this, Network.RegTest, configfile: "destream.conf");
this.Nodes.Add(node);
if (start)
node.Start();
......
......@@ -71,7 +71,7 @@ namespace DeStream.Bitcoin.IntegrationTests.EnvironmentMockUpHelpers
public void Start(string dataDir)
{
NodeSettings nodeSettings = new NodeSettings(Network.DeStreamRegTest, ProtocolVersion.ALT_PROTOCOL_VERSION, args:new string[] { "-conf=stratis.conf", "-datadir=" + dataDir }, loadConfiguration:false);
NodeSettings nodeSettings = new NodeSettings(Network.DeStreamRegTest, ProtocolVersion.ALT_PROTOCOL_VERSION, args:new string[] { "-conf=destream.conf", "-datadir=" + dataDir }, loadConfiguration:false);
var node = BuildFullNode(nodeSettings, this.callback);
......
......@@ -34,27 +34,27 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
stratisNodeSync.GenerateDeStream(105); // coinbase maturity = 100
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
destreamNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
destreamNodeSync.GenerateDeStream(105); // coinbase maturity = 100
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
var block = stratisNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(stratisNodeSync.FullNode.Chain.GetBlock(4).HashBlock).Result;
var block = destreamNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(destreamNodeSync.FullNode.Chain.GetBlock(4).HashBlock).Result;
var prevTrx = block.Transactions.First();
var dest = new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network);
var dest = new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network);
Transaction tx = new Transaction();
tx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(stratisNodeSync.MinerSecret.PubKey)));
tx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(destreamNodeSync.MinerSecret.PubKey)));
tx.AddOutput(new TxOut("25", dest.PubKey.Hash));
tx.AddOutput(new TxOut("24", new Key().PubKey.Hash)); // 1 btc fee
tx.Sign(stratisNodeSync.MinerSecret, false);
tx.Sign(destreamNodeSync.MinerSecret, false);
stratisNodeSync.Broadcast(tx);
destreamNodeSync.Broadcast(tx);
TestHelper.WaitLoop(() => stratisNodeSync.CreateRPCClient().GetRawMempool().Length == 1);
TestHelper.WaitLoop(() => destreamNodeSync.CreateRPCClient().GetRawMempool().Length == 1);
}
}
......@@ -63,31 +63,31 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.NotInIBD();
destreamNodeSync.NotInIBD();
stratisNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
stratisNodeSync.GenerateDeStream(105); // coinbase maturity = 100
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
destreamNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
destreamNodeSync.GenerateDeStream(105); // coinbase maturity = 100
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
var block = stratisNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(stratisNodeSync.FullNode.Chain.GetBlock(4).HashBlock).Result;
var block = destreamNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(destreamNodeSync.FullNode.Chain.GetBlock(4).HashBlock).Result;
var prevTrx = block.Transactions.First();
var dest1 = new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network);
var dest2 = new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network);
var dest1 = new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network);
var dest2 = new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network);
Transaction parentTx = new Transaction();
parentTx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(stratisNodeSync.MinerSecret.PubKey)));
parentTx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(destreamNodeSync.MinerSecret.PubKey)));
parentTx.AddOutput(new TxOut("25", dest1.PubKey.Hash));
parentTx.AddOutput(new TxOut("24", dest2.PubKey.Hash)); // 1 btc fee
parentTx.Sign(stratisNodeSync.MinerSecret, false);
stratisNodeSync.Broadcast(parentTx);
parentTx.Sign(destreamNodeSync.MinerSecret, false);
destreamNodeSync.Broadcast(parentTx);
// wiat for the trx to enter the pool
TestHelper.WaitLoop(() => stratisNodeSync.CreateRPCClient().GetRawMempool().Length == 1);
TestHelper.WaitLoop(() => destreamNodeSync.CreateRPCClient().GetRawMempool().Length == 1);
// mine the transactions in the mempool
stratisNodeSync.GenerateDeStream(1, stratisNodeSync.FullNode.MempoolManager().InfoAllAsync().Result.Select(s => s.Trx).ToList());
TestHelper.WaitLoop(() => stratisNodeSync.CreateRPCClient().GetRawMempool().Length == 0);
destreamNodeSync.GenerateDeStream(1, destreamNodeSync.FullNode.MempoolManager().InfoAllAsync().Result.Select(s => s.Trx).ToList());
TestHelper.WaitLoop(() => destreamNodeSync.CreateRPCClient().GetRawMempool().Length == 0);
//create a new trx spending both outputs
Transaction tx = new Transaction();
......@@ -96,8 +96,8 @@ namespace DeStream.Bitcoin.IntegrationTests
tx.AddOutput(new TxOut("48", new Key().PubKey.Hash)); // 1 btc fee
var signed = new TransactionBuilder().AddKeys(dest1, dest2).AddCoins(parentTx.Outputs.AsCoins()).SignTransaction(tx);
stratisNodeSync.Broadcast(signed);
TestHelper.WaitLoop(() => stratisNodeSync.CreateRPCClient().GetRawMempool().Length == 1);
destreamNodeSync.Broadcast(signed);
TestHelper.WaitLoop(() => destreamNodeSync.CreateRPCClient().GetRawMempool().Length == 1);
}
}
......@@ -106,36 +106,36 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.NotInIBD();
destreamNodeSync.NotInIBD();
stratisNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
stratisNodeSync.GenerateDeStream(201); // coinbase maturity = 100
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
destreamNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
destreamNodeSync.GenerateDeStream(201); // coinbase maturity = 100
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
var trxs = new List<Transaction>();
foreach (var index in Enumerable.Range(1, 100))
{
var block = stratisNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(stratisNodeSync.FullNode.Chain.GetBlock(index).HashBlock).Result;
var block = destreamNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(destreamNodeSync.FullNode.Chain.GetBlock(index).HashBlock).Result;
var prevTrx = block.Transactions.First();
var dest = new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network);
var dest = new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network);
Transaction tx = new Transaction();
tx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(stratisNodeSync.MinerSecret.PubKey)));
tx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(destreamNodeSync.MinerSecret.PubKey)));
tx.AddOutput(new TxOut("25", dest.PubKey.Hash));
tx.AddOutput(new TxOut("24", new Key().PubKey.Hash)); // 1 btc fee
tx.Sign(stratisNodeSync.MinerSecret, false);
tx.Sign(destreamNodeSync.MinerSecret, false);
trxs.Add(tx);
}
var options = new ParallelOptions { MaxDegreeOfParallelism = 10 };
Parallel.ForEach(trxs, options, transaction =>
{
stratisNodeSync.Broadcast(transaction);
destreamNodeSync.Broadcast(transaction);
});
TestHelper.WaitLoop(() => stratisNodeSync.CreateRPCClient().GetRawMempool().Length == 100);
TestHelper.WaitLoop(() => destreamNodeSync.CreateRPCClient().GetRawMempool().Length == 100);
}
}
......@@ -144,22 +144,22 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.NotInIBD();
stratisNodeSync.FullNode.Settings.RequireStandard = true; // make sure to test standard tx
destreamNodeSync.NotInIBD();
destreamNodeSync.FullNode.Settings.RequireStandard = true; // make sure to test standard tx
stratisNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
stratisNodeSync.GenerateDeStream(100); // coinbase maturity = 100
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
destreamNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
destreamNodeSync.GenerateDeStream(100); // coinbase maturity = 100
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
// Make sure skipping validation of transctions that were
// validated going into the memory pool does not allow
// double-spends in blocks to pass validation when they should not.
var scriptPubKey = PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(stratisNodeSync.MinerSecret.PubKey);
var genBlock = stratisNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(stratisNodeSync.FullNode.Chain.GetBlock(1).HashBlock).Result;
var scriptPubKey = PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(destreamNodeSync.MinerSecret.PubKey);
var genBlock = destreamNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(destreamNodeSync.FullNode.Chain.GetBlock(1).HashBlock).Result;
// Create a double-spend of mature coinbase txn:
List<Transaction> spends = new List<Transaction>(2);
......@@ -169,40 +169,40 @@ namespace DeStream.Bitcoin.IntegrationTests
trx.AddInput(new TxIn(new OutPoint(genBlock.Transactions[0].GetHash(), 0), scriptPubKey));
trx.AddOutput(Money.Cents(11), new Key().PubKey.Hash);
// Sign:
trx.Sign(stratisNodeSync.MinerSecret, false);
trx.Sign(destreamNodeSync.MinerSecret, false);
spends.Add(trx);
}
// Test 1: block with both of those transactions should be rejected.
var block = stratisNodeSync.GenerateDeStream(1, spends).Single();
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
Assert.True(stratisNodeSync.FullNode.Chain.Tip.HashBlock != block.GetHash());
var block = destreamNodeSync.GenerateDeStream(1, spends).Single();
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
Assert.True(destreamNodeSync.FullNode.Chain.Tip.HashBlock != block.GetHash());
// Test 2: ... and should be rejected if spend1 is in the memory pool
Assert.True(stratisNodeSync.AddToDeStreamMempool(spends[0]));
block = stratisNodeSync.GenerateDeStream(1, spends).Single();
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
Assert.True(stratisNodeSync.FullNode.Chain.Tip.HashBlock != block.GetHash());
stratisNodeSync.FullNode.MempoolManager().Clear().Wait();
Assert.True(destreamNodeSync.AddToDeStreamMempool(spends[0]));
block = destreamNodeSync.GenerateDeStream(1, spends).Single();
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
Assert.True(destreamNodeSync.FullNode.Chain.Tip.HashBlock != block.GetHash());
destreamNodeSync.FullNode.MempoolManager().Clear().Wait();
// Test 3: ... and should be rejected if spend2 is in the memory pool
Assert.True(stratisNodeSync.AddToDeStreamMempool(spends[1]));
block = stratisNodeSync.GenerateDeStream(1, spends).Single();
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
Assert.True(stratisNodeSync.FullNode.Chain.Tip.HashBlock != block.GetHash());
stratisNodeSync.FullNode.MempoolManager().Clear().Wait();
Assert.True(destreamNodeSync.AddToDeStreamMempool(spends[1]));
block = destreamNodeSync.GenerateDeStream(1, spends).Single();
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
Assert.True(destreamNodeSync.FullNode.Chain.Tip.HashBlock != block.GetHash());
destreamNodeSync.FullNode.MempoolManager().Clear().Wait();
// Final sanity test: first spend in mempool, second in block, that's OK:
List<Transaction> oneSpend = new List<Transaction>();
oneSpend.Add(spends[0]);
Assert.True(stratisNodeSync.AddToDeStreamMempool(spends[1]));
block = stratisNodeSync.GenerateDeStream(1, oneSpend).Single();
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
Assert.True(stratisNodeSync.FullNode.Chain.Tip.HashBlock == block.GetHash());
Assert.True(destreamNodeSync.AddToDeStreamMempool(spends[1]));
block = destreamNodeSync.GenerateDeStream(1, oneSpend).Single();
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
Assert.True(destreamNodeSync.FullNode.Chain.Tip.HashBlock == block.GetHash());
// spends[1] should have been removed from the mempool when the
// block with spends[0] is accepted:
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.MempoolManager().MempoolSize().Result == 0);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.MempoolManager().MempoolSize().Result == 0);
}
}
......@@ -219,65 +219,65 @@ namespace DeStream.Bitcoin.IntegrationTests
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNode = builder.CreateDeStreamPowNode();
var destreamNode = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNode.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNode.FullNode.Network));
destreamNode.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNode.FullNode.Network));
// 50 orphan transactions:
for (ulong i = 0; i < 50; i++)
{
Transaction tx = new Transaction();
tx.AddInput(new TxIn(new OutPoint(randHash(), 0), new Script(OpcodeType.OP_1)));
tx.AddOutput(new TxOut(new Money(1 * Money.CENT), stratisNode.MinerSecret.ScriptPubKey));
tx.AddOutput(new TxOut(new Money(1 * Money.CENT), destreamNode.MinerSecret.ScriptPubKey));
stratisNode.FullNode.MempoolManager().Orphans.AddOrphanTx(i, tx).Wait();
destreamNode.FullNode.MempoolManager().Orphans.AddOrphanTx(i, tx).Wait();
}
Assert.Equal(50, stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Count);
Assert.Equal(50, destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Count);
// ... and 50 that depend on other orphans:
for (ulong i = 0; i < 50; i++)
{
var txPrev = stratisNode.FullNode.MempoolManager().Orphans.OrphansList().ElementAt(rand.Next(stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Count));
var txPrev = destreamNode.FullNode.MempoolManager().Orphans.OrphansList().ElementAt(rand.Next(destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Count));
Transaction tx = new Transaction();
tx.AddInput(new TxIn(new OutPoint(txPrev.Tx.GetHash(), 0), new Script(OpcodeType.OP_1)));
tx.AddOutput(new TxOut(new Money((1 + i + 100) * Money.CENT), stratisNode.MinerSecret.ScriptPubKey));
stratisNode.FullNode.MempoolManager().Orphans.AddOrphanTx(i, tx).Wait();
tx.AddOutput(new TxOut(new Money((1 + i + 100) * Money.CENT), destreamNode.MinerSecret.ScriptPubKey));
destreamNode.FullNode.MempoolManager().Orphans.AddOrphanTx(i, tx).Wait();
}
Assert.Equal(100, stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Count);
Assert.Equal(100, destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Count);
// This really-big orphan should be ignored:
for (ulong i = 0; i < 10; i++)
{
var txPrev = stratisNode.FullNode.MempoolManager().Orphans.OrphansList().ElementAt(rand.Next(stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Count));
var txPrev = destreamNode.FullNode.MempoolManager().Orphans.OrphansList().ElementAt(rand.Next(destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Count));
Transaction tx = new Transaction();
tx.AddOutput(new TxOut(new Money(1 * Money.CENT), stratisNode.MinerSecret.ScriptPubKey));
tx.AddOutput(new TxOut(new Money(1 * Money.CENT), destreamNode.MinerSecret.ScriptPubKey));
foreach (var index in Enumerable.Range(0, 2777))
tx.AddInput(new TxIn(new OutPoint(txPrev.Tx.GetHash(), index), new Script(OpcodeType.OP_1)));
Assert.False(stratisNode.FullNode.MempoolManager().Orphans.AddOrphanTx(i, tx).Result);
Assert.False(destreamNode.FullNode.MempoolManager().Orphans.AddOrphanTx(i, tx).Result);
}
Assert.Equal(100, stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Count);
Assert.Equal(100, destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Count);
// Test EraseOrphansFor:
for (ulong i = 0; i < 3; i++)
{
var sizeBefore = stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Count;
stratisNode.FullNode.MempoolManager().Orphans.EraseOrphansFor(i).Wait();
Assert.True(stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Count < sizeBefore);
var sizeBefore = destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Count;
destreamNode.FullNode.MempoolManager().Orphans.EraseOrphansFor(i).Wait();
Assert.True(destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Count < sizeBefore);
}
// Test LimitOrphanTxSize() function:
stratisNode.FullNode.MempoolManager().Orphans.LimitOrphanTxSizeAsync(40).Wait();
Assert.True(stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Count <= 40);
stratisNode.FullNode.MempoolManager().Orphans.LimitOrphanTxSizeAsync(10).Wait();
Assert.True(stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Count <= 10);
stratisNode.FullNode.MempoolManager().Orphans.LimitOrphanTxSizeAsync(0).Wait();
Assert.True(!stratisNode.FullNode.MempoolManager().Orphans.OrphansList().Any());
destreamNode.FullNode.MempoolManager().Orphans.LimitOrphanTxSizeAsync(40).Wait();
Assert.True(destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Count <= 40);
destreamNode.FullNode.MempoolManager().Orphans.LimitOrphanTxSizeAsync(10).Wait();
Assert.True(destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Count <= 10);
destreamNode.FullNode.MempoolManager().Orphans.LimitOrphanTxSizeAsync(0).Wait();
Assert.True(!destreamNode.FullNode.MempoolManager().Orphans.OrphansList().Any());
}
}
......@@ -286,40 +286,40 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.NotInIBD();
destreamNodeSync.NotInIBD();
stratisNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
stratisNodeSync.GenerateDeStream(101); // coinbase maturity = 100
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.ChainBehaviorState.ConsensusTip.HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.HighestPersistedBlock().HashBlock == stratisNodeSync.FullNode.Chain.Tip.HashBlock);
destreamNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
destreamNodeSync.GenerateDeStream(101); // coinbase maturity = 100
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ConsensusLoop().Tip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.ChainBehaviorState.ConsensusTip.HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.HighestPersistedBlock().HashBlock == destreamNodeSync.FullNode.Chain.Tip.HashBlock);
var block = stratisNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(stratisNodeSync.FullNode.Chain.GetBlock(1).HashBlock).Result;
var block = destreamNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(destreamNodeSync.FullNode.Chain.GetBlock(1).HashBlock).Result;
var prevTrx = block.Transactions.First();
var dest = new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network);
var dest = new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network);
var key = new Key();
Transaction tx = new Transaction();
tx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(stratisNodeSync.MinerSecret.PubKey)));
tx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(destreamNodeSync.MinerSecret.PubKey)));
tx.AddOutput(new TxOut("25", dest.PubKey.Hash));
tx.AddOutput(new TxOut("24", key.PubKey.Hash)); // 1 btc fee
tx.Sign(stratisNodeSync.MinerSecret, false);
tx.Sign(destreamNodeSync.MinerSecret, false);
Transaction txOrphan = new Transaction();
txOrphan.AddInput(new TxIn(new OutPoint(tx.GetHash(), 1), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(key.PubKey)));
txOrphan.AddOutput(new TxOut("10", new Key().PubKey.Hash));
txOrphan.Sign(key.GetBitcoinSecret(stratisNodeSync.FullNode.Network), false);
txOrphan.Sign(key.GetBitcoinSecret(destreamNodeSync.FullNode.Network), false);
// broadcast the orphan
stratisNodeSync.Broadcast(txOrphan);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.MempoolManager().Orphans.OrphansList().Count == 1);
destreamNodeSync.Broadcast(txOrphan);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.MempoolManager().Orphans.OrphansList().Count == 1);
// broadcast the parent
stratisNodeSync.Broadcast(tx);
TestHelper.WaitLoop(() => stratisNodeSync.FullNode.MempoolManager().Orphans.OrphansList().Count == 0);
destreamNodeSync.Broadcast(tx);
TestHelper.WaitLoop(() => destreamNodeSync.FullNode.MempoolManager().Orphans.OrphansList().Count == 0);
// wait for orphan to get in the pool
TestHelper.WaitLoop(() => stratisNodeSync.CreateRPCClient().GetRawMempool().Length == 2);
TestHelper.WaitLoop(() => destreamNodeSync.CreateRPCClient().GetRawMempool().Length == 2);
}
}
......@@ -328,69 +328,69 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var stratisNode1 = builder.CreateDeStreamPowNode();
var stratisNode2 = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
var destreamNode1 = builder.CreateDeStreamPowNode();
var destreamNode2 = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.NotInIBD();
stratisNode1.NotInIBD();
stratisNode2.NotInIBD();
destreamNodeSync.NotInIBD();
destreamNode1.NotInIBD();
destreamNode2.NotInIBD();
// generate blocks and wait for the downloader to pickup
stratisNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network));
stratisNodeSync.GenerateDeStreamWithMiner(105); // coinbase maturity = 100
destreamNodeSync.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network));
destreamNodeSync.GenerateDeStreamWithMiner(105); // coinbase maturity = 100
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisNodeSync));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamNodeSync));
// sync both nodes
stratisNode1.CreateRPCClient().AddNode(stratisNodeSync.Endpoint, true);
stratisNode2.CreateRPCClient().AddNode(stratisNodeSync.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisNode1, stratisNodeSync));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisNode2, stratisNodeSync));
destreamNode1.CreateRPCClient().AddNode(destreamNodeSync.Endpoint, true);
destreamNode2.CreateRPCClient().AddNode(destreamNodeSync.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamNode1, destreamNodeSync));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamNode2, destreamNodeSync));
// create some transactions and push them to the pool
var trxs = new List<Transaction>();
foreach (var index in Enumerable.Range(1, 5))
{
var block = stratisNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(stratisNodeSync.FullNode.Chain.GetBlock(index).HashBlock).Result;
var block = destreamNodeSync.FullNode.BlockStoreManager().BlockRepository.GetAsync(destreamNodeSync.FullNode.Chain.GetBlock(index).HashBlock).Result;
var prevTrx = block.Transactions.First();
var dest = new BitcoinSecret(new Key(), stratisNodeSync.FullNode.Network);
var dest = new BitcoinSecret(new Key(), destreamNodeSync.FullNode.Network);
Transaction tx = new Transaction();
tx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(stratisNodeSync.MinerSecret.PubKey)));
tx.AddInput(new TxIn(new OutPoint(prevTrx.GetHash(), 0), PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(destreamNodeSync.MinerSecret.PubKey)));
tx.AddOutput(new TxOut("25", dest.PubKey.Hash));
tx.AddOutput(new TxOut("24", new Key().PubKey.Hash)); // 1 btc fee
tx.Sign(stratisNodeSync.MinerSecret, false);
tx.Sign(destreamNodeSync.MinerSecret, false);
trxs.Add(tx);
}
var options = new ParallelOptions { MaxDegreeOfParallelism = 5 };
Parallel.ForEach(trxs, options, transaction =>
{
stratisNodeSync.Broadcast(transaction);
destreamNodeSync.Broadcast(transaction);
});
// wait for all nodes to have all trx
TestHelper.WaitLoop(() => stratisNodeSync.CreateRPCClient().GetRawMempool().Length == 5);
TestHelper.WaitLoop(() => destreamNodeSync.CreateRPCClient().GetRawMempool().Length == 5);
// the full node should be connected to both nodes
Assert.True(stratisNodeSync.FullNode.ConnectionManager.ConnectedPeers.Count() >= 2);
Assert.True(destreamNodeSync.FullNode.ConnectionManager.ConnectedPeers.Count() >= 2);
// reset the trickle timer on the full node that has the transactions in the pool
foreach (var node in stratisNodeSync.FullNode.ConnectionManager.ConnectedPeers) node.Behavior<MempoolBehavior>().NextInvSend = 0;
foreach (var node in destreamNodeSync.FullNode.ConnectionManager.ConnectedPeers) node.Behavior<MempoolBehavior>().NextInvSend = 0;
TestHelper.WaitLoop(() => stratisNode1.CreateRPCClient().GetRawMempool().Length == 5);
TestHelper.WaitLoop(() => stratisNode2.CreateRPCClient().GetRawMempool().Length == 5);
TestHelper.WaitLoop(() => destreamNode1.CreateRPCClient().GetRawMempool().Length == 5);
TestHelper.WaitLoop(() => destreamNode2.CreateRPCClient().GetRawMempool().Length == 5);
// mine the transactions in the mempool
stratisNodeSync.GenerateDeStreamWithMiner(1);
TestHelper.WaitLoop(() => stratisNodeSync.CreateRPCClient().GetRawMempool().Length == 0);
destreamNodeSync.GenerateDeStreamWithMiner(1);
TestHelper.WaitLoop(() => destreamNodeSync.CreateRPCClient().GetRawMempool().Length == 0);
// wait for block and mempool to change
TestHelper.WaitLoop(() => stratisNode1.CreateRPCClient().GetBestBlockHash() == stratisNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => stratisNode2.CreateRPCClient().GetBestBlockHash() == stratisNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => stratisNode1.CreateRPCClient().GetRawMempool().Length == 0);
TestHelper.WaitLoop(() => stratisNode2.CreateRPCClient().GetRawMempool().Length == 0);
TestHelper.WaitLoop(() => destreamNode1.CreateRPCClient().GetBestBlockHash() == destreamNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamNode2.CreateRPCClient().GetBestBlockHash() == destreamNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamNode1.CreateRPCClient().GetRawMempool().Length == 0);
TestHelper.WaitLoop(() => destreamNode2.CreateRPCClient().GetRawMempool().Length == 0);
}
}
}
......
......@@ -46,26 +46,26 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNode = builder.CreateDeStreamPowNode();
var destreamNode = builder.CreateDeStreamPowNode();
var coreNode = builder.CreateNode();
builder.StartAll();
stratisNode.NotInIBD();
destreamNode.NotInIBD();
var tip = coreNode.FindBlock(10).Last();
stratisNode.CreateRPCClient().AddNode(coreNode.Endpoint, true);
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNode.CreateRPCClient().GetBestBlockHash());
var bestBlockHash = stratisNode.CreateRPCClient().GetBestBlockHash();
destreamNode.CreateRPCClient().AddNode(coreNode.Endpoint, true);
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreNode.CreateRPCClient().GetBestBlockHash());
var bestBlockHash = destreamNode.CreateRPCClient().GetBestBlockHash();
Assert.Equal(tip.GetHash(), bestBlockHash);
//Now check if Core connect to stratis
stratisNode.CreateRPCClient().RemoveNode(coreNode.Endpoint);
//Now check if Core connect to destream
destreamNode.CreateRPCClient().RemoveNode(coreNode.Endpoint);
TestHelper.WaitLoop(() => coreNode.CreateRPCClient().GetPeersInfo().Length == 0);
tip = coreNode.FindBlock(10).Last();
coreNode.CreateRPCClient().AddNode(stratisNode.Endpoint, true);
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNode.CreateRPCClient().GetBestBlockHash());
bestBlockHash = stratisNode.CreateRPCClient().GetBestBlockHash();
coreNode.CreateRPCClient().AddNode(destreamNode.Endpoint, true);
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreNode.CreateRPCClient().GetBestBlockHash());
bestBlockHash = destreamNode.CreateRPCClient().GetBestBlockHash();
Assert.Equal(tip.GetHash(), bestBlockHash);
}
}
......@@ -75,29 +75,29 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNode = builder.CreateDeStreamPowNode();
var stratisNodeSync = builder.CreateDeStreamPowNode();
var destreamNode = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
var coreCreateNode = builder.CreateNode();
builder.StartAll();
stratisNode.NotInIBD();
stratisNodeSync.NotInIBD();
destreamNode.NotInIBD();
destreamNodeSync.NotInIBD();
// first seed a core node with blocks and sync them to a stratis node
// and wait till the stratis node is fully synced
// first seed a core node with blocks and sync them to a destream node
// and wait till the destream node is fully synced
var tip = coreCreateNode.FindBlock(5).Last();
stratisNode.CreateRPCClient().AddNode(coreCreateNode.Endpoint, true);
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreCreateNode.CreateRPCClient().GetBestBlockHash());
var bestBlockHash = stratisNode.CreateRPCClient().GetBestBlockHash();
destreamNode.CreateRPCClient().AddNode(coreCreateNode.Endpoint, true);
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreCreateNode.CreateRPCClient().GetBestBlockHash());
var bestBlockHash = destreamNode.CreateRPCClient().GetBestBlockHash();
Assert.Equal(tip.GetHash(), bestBlockHash);
// add a new stratis node which will download
// add a new destream node which will download
// the blocks using the GetData payload
stratisNodeSync.CreateRPCClient().AddNode(stratisNode.Endpoint, true);
destreamNodeSync.CreateRPCClient().AddNode(destreamNode.Endpoint, true);
// wait for download and assert
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == stratisNodeSync.CreateRPCClient().GetBestBlockHash());
bestBlockHash = stratisNodeSync.CreateRPCClient().GetBestBlockHash();
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == destreamNodeSync.CreateRPCClient().GetBestBlockHash());
bestBlockHash = destreamNodeSync.CreateRPCClient().GetBestBlockHash();
Assert.Equal(tip.GetHash(), bestBlockHash);
}
}
......@@ -107,29 +107,29 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNode = builder.CreateDeStreamPowNode();
var destreamNode = builder.CreateDeStreamPowNode();
var coreNodeSync = builder.CreateNode();
var coreCreateNode = builder.CreateNode();
builder.StartAll();
stratisNode.NotInIBD();
destreamNode.NotInIBD();
// first seed a core node with blocks and sync them to a stratis node
// and wait till the stratis node is fully synced
// first seed a core node with blocks and sync them to a destream node
// and wait till the destream node is fully synced
var tip = coreCreateNode.FindBlock(5).Last();
stratisNode.CreateRPCClient().AddNode(coreCreateNode.Endpoint, true);
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreCreateNode.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => stratisNode.FullNode.HighestPersistedBlock().HashBlock == stratisNode.FullNode.Chain.Tip.HashBlock);
destreamNode.CreateRPCClient().AddNode(coreCreateNode.Endpoint, true);
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreCreateNode.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamNode.FullNode.HighestPersistedBlock().HashBlock == destreamNode.FullNode.Chain.Tip.HashBlock);
var bestBlockHash = stratisNode.CreateRPCClient().GetBestBlockHash();
var bestBlockHash = destreamNode.CreateRPCClient().GetBestBlockHash();
Assert.Equal(tip.GetHash(), bestBlockHash);
// add a new stratis node which will download
// add a new destream node which will download
// the blocks using the GetData payload
coreNodeSync.CreateRPCClient().AddNode(stratisNode.Endpoint, true);
coreNodeSync.CreateRPCClient().AddNode(destreamNode.Endpoint, true);
// wait for download and assert
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNodeSync.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreNodeSync.CreateRPCClient().GetBestBlockHash());
bestBlockHash = coreNodeSync.CreateRPCClient().GetBestBlockHash();
Assert.Equal(tip.GetHash(), bestBlockHash);
}
......@@ -146,74 +146,74 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisMiner = builder.CreateDeStreamPosNode();
var stratisSyncer = builder.CreateDeStreamPosNode();
var stratisReorg = builder.CreateDeStreamPosNode();
var destreamMiner = builder.CreateDeStreamPosNode();
var destreamSyncer = builder.CreateDeStreamPosNode();
var destreamReorg = builder.CreateDeStreamPosNode();
builder.StartAll();
stratisMiner.NotInIBD();
stratisSyncer.NotInIBD();
stratisReorg.NotInIBD();
destreamMiner.NotInIBD();
destreamSyncer.NotInIBD();
destreamReorg.NotInIBD();
// TODO: set the max allowed reorg threshold here
// assume a reorg of 10 blocks is not allowed.
stratisMiner.FullNode.ChainBehaviorState.MaxReorgLength = 10;
stratisSyncer.FullNode.ChainBehaviorState.MaxReorgLength = 10;
stratisReorg.FullNode.ChainBehaviorState.MaxReorgLength = 10;
destreamMiner.FullNode.ChainBehaviorState.MaxReorgLength = 10;
destreamSyncer.FullNode.ChainBehaviorState.MaxReorgLength = 10;
destreamReorg.FullNode.ChainBehaviorState.MaxReorgLength = 10;
stratisMiner.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisMiner.FullNode.Network));
stratisReorg.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisReorg.FullNode.Network));
destreamMiner.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamMiner.FullNode.Network));
destreamReorg.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamReorg.FullNode.Network));
stratisMiner.GenerateDeStreamWithMiner(1);
destreamMiner.GenerateDeStreamWithMiner(1);
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisMiner));
stratisMiner.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
stratisMiner.CreateRPCClient().AddNode(stratisSyncer.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamMiner));
destreamMiner.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
destreamMiner.CreateRPCClient().AddNode(destreamSyncer.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisMiner, stratisSyncer));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisMiner, stratisReorg));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamMiner, destreamSyncer));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamMiner, destreamReorg));
// create a reorg by mining on two different chains
// ================================================
stratisMiner.CreateRPCClient().RemoveNode(stratisReorg.Endpoint);
stratisSyncer.CreateRPCClient().RemoveNode(stratisReorg.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(stratisReorg));
destreamMiner.CreateRPCClient().RemoveNode(destreamReorg.Endpoint);
destreamSyncer.CreateRPCClient().RemoveNode(destreamReorg.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(destreamReorg));
var t1 = Task.Run(() => stratisMiner.GenerateDeStreamWithMiner(11));
var t2 = Task.Delay(1000).ContinueWith(t => stratisReorg.GenerateDeStreamWithMiner(12));
var t1 = Task.Run(() => destreamMiner.GenerateDeStreamWithMiner(11));
var t2 = Task.Delay(1000).ContinueWith(t => destreamReorg.GenerateDeStreamWithMiner(12));
Task.WaitAll(t1, t2);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisMiner));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisReorg));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamMiner));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamReorg));
// make sure the nodes are actually on different chains.
Assert.NotEqual(stratisMiner.FullNode.Chain.GetBlock(2).HashBlock, stratisReorg.FullNode.Chain.GetBlock(2).HashBlock);
Assert.NotEqual(destreamMiner.FullNode.Chain.GetBlock(2).HashBlock, destreamReorg.FullNode.Chain.GetBlock(2).HashBlock);
TestHelper.TriggerSync(stratisSyncer);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisMiner, stratisSyncer));
TestHelper.TriggerSync(destreamSyncer);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamMiner, destreamSyncer));
// The hash before the reorg node is connected.
var hashBeforeReorg = stratisMiner.FullNode.Chain.Tip.HashBlock;
var hashBeforeReorg = destreamMiner.FullNode.Chain.Tip.HashBlock;
// connect the reorg chain
stratisMiner.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
stratisSyncer.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
destreamMiner.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
destreamSyncer.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
// trigger nodes to sync
TestHelper.TriggerSync(stratisMiner);
TestHelper.TriggerSync(stratisReorg);
TestHelper.TriggerSync(stratisSyncer);
TestHelper.TriggerSync(destreamMiner);
TestHelper.TriggerSync(destreamReorg);
TestHelper.TriggerSync(destreamSyncer);
// wait for the synced chain to get headers updated.
TestHelper.WaitLoop(() => !stratisReorg.FullNode.ConnectionManager.ConnectedPeers.Any());
TestHelper.WaitLoop(() => !destreamReorg.FullNode.ConnectionManager.ConnectedPeers.Any());
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisMiner, stratisSyncer));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReorg, stratisMiner) == false);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReorg, stratisSyncer) == false);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamMiner, destreamSyncer));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReorg, destreamMiner) == false);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReorg, destreamSyncer) == false);
// check that a reorg did not happen.
Assert.Equal(hashBeforeReorg, stratisSyncer.FullNode.Chain.Tip.HashBlock);
Assert.Equal(hashBeforeReorg, destreamSyncer.FullNode.Chain.Tip.HashBlock);
}
}
finally
......@@ -230,7 +230,6 @@ namespace DeStream.Bitcoin.IntegrationTests
/// arrives from the puller. Then another block comes from the puller extending the chain without the block we mined.
/// </para>
/// </summary>
/// <seealso cref="https://github.com/stratisproject/DeStreamBitcoinFullNode/issues/636"/>
[Fact]
public void PullerVsMinerRaceCondition()
{
......@@ -243,50 +242,50 @@ namespace DeStream.Bitcoin.IntegrationTests
using (NodeBuilder builder = NodeBuilder.Create())
{
// This represents local node.
var stratisMinerLocal = builder.CreateDeStreamPosNode();
var destreamMinerLocal = builder.CreateDeStreamPosNode();
// This represents remote, which blocks are received by local node using its puller.
var stratisMinerRemote = builder.CreateDeStreamPosNode();
var destreamMinerRemote = builder.CreateDeStreamPosNode();
builder.StartAll();
stratisMinerLocal.NotInIBD();
stratisMinerRemote.NotInIBD();
destreamMinerLocal.NotInIBD();
destreamMinerRemote.NotInIBD();
stratisMinerLocal.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisMinerLocal.FullNode.Network));
stratisMinerRemote.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisMinerRemote.FullNode.Network));
destreamMinerLocal.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamMinerLocal.FullNode.Network));
destreamMinerRemote.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamMinerRemote.FullNode.Network));
// Let's mine block Ap and Bp.
stratisMinerRemote.GenerateDeStreamWithMiner(2);
destreamMinerRemote.GenerateDeStreamWithMiner(2);
// Wait for block repository for block sync to work.
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisMinerRemote));
stratisMinerLocal.CreateRPCClient().AddNode(stratisMinerRemote.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamMinerRemote));
destreamMinerLocal.CreateRPCClient().AddNode(destreamMinerRemote.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisMinerLocal, stratisMinerRemote));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamMinerLocal, destreamMinerRemote));
// Now disconnect the peers and mine block C2p on remote.
stratisMinerLocal.CreateRPCClient().RemoveNode(stratisMinerRemote.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(stratisMinerRemote));
destreamMinerLocal.CreateRPCClient().RemoveNode(destreamMinerRemote.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(destreamMinerRemote));
// Mine block C2p.
stratisMinerRemote.GenerateDeStreamWithMiner(1);
destreamMinerRemote.GenerateDeStreamWithMiner(1);
Thread.Sleep(2000);
// Now reconnect nodes and mine block C1s before C2p arrives.
stratisMinerLocal.CreateRPCClient().AddNode(stratisMinerRemote.Endpoint, true);
stratisMinerLocal.GenerateDeStreamWithMiner(1);
destreamMinerLocal.CreateRPCClient().AddNode(destreamMinerRemote.Endpoint, true);
destreamMinerLocal.GenerateDeStreamWithMiner(1);
// Mine block Dp.
uint256 dpHash = stratisMinerRemote.GenerateDeStreamWithMiner(1)[0];
uint256 dpHash = destreamMinerRemote.GenerateDeStreamWithMiner(1)[0];
// Now we wait until the local node's chain tip has correct hash of Dp.
TestHelper.WaitLoop(() => stratisMinerLocal.FullNode.Chain.Tip.HashBlock.Equals(dpHash));
TestHelper.WaitLoop(() => destreamMinerLocal.FullNode.Chain.Tip.HashBlock.Equals(dpHash));
// Then give it time to receive the block from the puller.
Thread.Sleep(2500);
// Check that local node accepted the Dp as consensus tip.
Assert.Equal(stratisMinerLocal.FullNode.ChainBehaviorState.ConsensusTip.HashBlock, dpHash);
Assert.Equal(destreamMinerLocal.FullNode.ChainBehaviorState.ConsensusTip.HashBlock, dpHash);
}
}
finally
......
......@@ -28,7 +28,7 @@ namespace DeStream.Bitcoin.IntegrationTests
coreNode.ConfigParameters.AddOrReplace("printtoconsole", "0");
coreNode.Start();
CoreNode stratisNode = builder.CreateDeStreamPowNode(true, fullNodeBuilder =>
CoreNode destreamNode = builder.CreateDeStreamPowNode(true, fullNodeBuilder =>
{
fullNodeBuilder
.UsePowConsensus()
......@@ -39,15 +39,14 @@ namespace DeStream.Bitcoin.IntegrationTests
.AddRPC();
});
RPCClient stratisNodeRpc = stratisNode.CreateRPCClient();
RPCClient destreamNodeRpc = destreamNode.CreateRPCClient();
RPCClient coreRpc = coreNode.CreateRPCClient();
coreRpc.AddNode(stratisNode.Endpoint, false);
stratisNodeRpc.AddNode(coreNode.Endpoint, false);
coreRpc.AddNode(destreamNode.Endpoint, false);
destreamNodeRpc.AddNode(coreNode.Endpoint, false);
// core (in version 0.15.1) only mines segwit blocks above a certain height on regtest
// future versions of core will change that behaviour so this test may need to be changed in the future
// see issue for more details https://github.com/stratisproject/DeStreamBitcoinFullNode/issues/1028
BIP9DeploymentsParameters prevSegwitDeployment = Network.RegTest.Consensus.BIP9Deployments[BIP9Deployments.Segwit];
Network.RegTest.Consensus.BIP9Deployments[BIP9Deployments.Segwit] = new BIP9DeploymentsParameters(1, 0, DateTime.Now.AddDays(50).ToUnixTimestamp());
......@@ -56,7 +55,7 @@ namespace DeStream.Bitcoin.IntegrationTests
// generate 450 blocks, block 431 will be segwit activated.
coreRpc.Generate(450);
TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNode.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamNode.CreateRPCClient().GetBestBlockHash() == coreNode.CreateRPCClient().GetBestBlockHash());
// segwit activation on Bitcoin regtest.
// - On regtest deployment state changes every 144 block, the threshold for activating a rule is 108 blocks.
......@@ -66,11 +65,11 @@ namespace DeStream.Bitcoin.IntegrationTests
// - LockedIn 287 (as segwit should already be signaled in blocks).
// - Active at block 431.
IConsensusLoop consensusLoop = stratisNode.FullNode.NodeService<IConsensusLoop>();
ThresholdState[] segwitDefinedState = consensusLoop.NodeDeployments.BIP9.GetStates(stratisNode.FullNode.Chain.GetBlock(142));
ThresholdState[] segwitStartedState = consensusLoop.NodeDeployments.BIP9.GetStates(stratisNode.FullNode.Chain.GetBlock(143));
ThresholdState[] segwitLockedInState = consensusLoop.NodeDeployments.BIP9.GetStates(stratisNode.FullNode.Chain.GetBlock(287));
ThresholdState[] segwitActiveState = consensusLoop.NodeDeployments.BIP9.GetStates(stratisNode.FullNode.Chain.GetBlock(431));
IConsensusLoop consensusLoop = destreamNode.FullNode.NodeService<IConsensusLoop>();
ThresholdState[] segwitDefinedState = consensusLoop.NodeDeployments.BIP9.GetStates(destreamNode.FullNode.Chain.GetBlock(142));
ThresholdState[] segwitStartedState = consensusLoop.NodeDeployments.BIP9.GetStates(destreamNode.FullNode.Chain.GetBlock(143));
ThresholdState[] segwitLockedInState = consensusLoop.NodeDeployments.BIP9.GetStates(destreamNode.FullNode.Chain.GetBlock(287));
ThresholdState[] segwitActiveState = consensusLoop.NodeDeployments.BIP9.GetStates(destreamNode.FullNode.Chain.GetBlock(431));
// check that segwit is got activated at block 431
Assert.Equal(ThresholdState.Defined, segwitDefinedState.GetValue((int)BIP9Deployments.Segwit));
......@@ -87,8 +86,8 @@ namespace DeStream.Bitcoin.IntegrationTests
private void TestSegwit_MinedOnDeStreamNode_ActivatedOn_CoreNode()
{
// TODO: mine segwit onh a stratis node on the bitcoin network
// write a tests that mines segwit blocks on the stratis node
// TODO: mine segwit onh a destream node on the bitcoin network
// write a tests that mines segwit blocks on the destream node
// and signals them to a core not, then segwit will get activated on core
}
}
......
......@@ -35,62 +35,62 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisSender = builder.CreateDeStreamPowNode();
var stratisReceiver = builder.CreateDeStreamPowNode();
var destreamSender = builder.CreateDeStreamPowNode();
var destreamReceiver = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisSender.NotInIBD();
stratisReceiver.NotInIBD();
destreamSender.NotInIBD();
destreamReceiver.NotInIBD();
// get a key from the wallet
var mnemonic1 = stratisSender.FullNode.WalletManager().CreateWallet("123456", "mywallet");
var mnemonic2 = stratisReceiver.FullNode.WalletManager().CreateWallet("123456", "mywallet");
var mnemonic1 = destreamSender.FullNode.WalletManager().CreateWallet("123456", "mywallet");
var mnemonic2 = destreamReceiver.FullNode.WalletManager().CreateWallet("123456", "mywallet");
Assert.Equal(12, mnemonic1.Words.Length);
Assert.Equal(12, mnemonic2.Words.Length);
var addr = stratisSender.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var wallet = stratisSender.FullNode.WalletManager().GetWalletByName("mywallet");
var addr = destreamSender.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var wallet = destreamSender.FullNode.WalletManager().GetWalletByName("mywallet");
var key = wallet.GetExtendedPrivateKeyForAddress("123456", addr).PrivateKey;
stratisSender.SetDummyMinerSecret(new BitcoinSecret(key, stratisSender.FullNode.Network));
var maturity = (int)stratisSender.FullNode.Network.Consensus.Option<PowConsensusOptions>().CoinbaseMaturity;
stratisSender.GenerateDeStream(maturity + 5);
destreamSender.SetDummyMinerSecret(new BitcoinSecret(key, destreamSender.FullNode.Network));
var maturity = (int)destreamSender.FullNode.Network.Consensus.Option<PowConsensusOptions>().CoinbaseMaturity;
destreamSender.GenerateDeStream(maturity + 5);
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
// the mining should add coins to the wallet
var total = stratisSender.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
var total = destreamSender.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
Assert.Equal(Money.COIN * 105 * 50, total);
// sync both nodes
stratisSender.CreateRPCClient().AddNode(stratisReceiver.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
destreamSender.CreateRPCClient().AddNode(destreamReceiver.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
// send coins to the receiver
var sendto = stratisReceiver.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var trx = stratisSender.FullNode.WalletTransactionHandler().BuildTransaction(CreateContext(
var sendto = destreamReceiver.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var trx = destreamSender.FullNode.WalletTransactionHandler().BuildTransaction(CreateContext(
new WalletAccountReference("mywallet", "account 0"), "123456", sendto.ScriptPubKey, Money.COIN * 100, FeeType.Medium, 101));
// broadcast to the other node
stratisSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(trx.ToHex()));
destreamSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(trx.ToHex()));
// wait for the trx to arrive
TestHelper.WaitLoop(() => stratisReceiver.CreateRPCClient().GetRawMempool().Length > 0);
TestHelper.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any());
TestHelper.WaitLoop(() => destreamReceiver.CreateRPCClient().GetRawMempool().Length > 0);
TestHelper.WaitLoop(() => destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any());
var receivetotal = stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
var receivetotal = destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
Assert.Equal(Money.COIN * 100, receivetotal);
Assert.Null(stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
Assert.Null(destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
// generate two new blocks do the trx is confirmed
stratisSender.GenerateDeStream(1, new List<Transaction>(new[] { trx.Clone() }));
stratisSender.GenerateDeStream(1);
destreamSender.GenerateDeStream(1, new List<Transaction>(new[] { trx.Clone() }));
destreamSender.GenerateDeStream(1);
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
TestHelper.WaitLoop(() => maturity + 6 == stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
TestHelper.WaitLoop(() => maturity + 6 == destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
}
}
......@@ -99,35 +99,35 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
CoreNode stratisSender = builder.CreateDeStreamPowNode();
CoreNode stratisReceiver = builder.CreateDeStreamPowNode();
CoreNode destreamSender = builder.CreateDeStreamPowNode();
CoreNode destreamReceiver = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisSender.NotInIBD();
stratisReceiver.NotInIBD();
destreamSender.NotInIBD();
destreamReceiver.NotInIBD();
stratisSender.FullNode.WalletManager().CreateWallet("123456", "mywallet");
stratisReceiver.FullNode.WalletManager().CreateWallet("123456", "mywallet");
destreamSender.FullNode.WalletManager().CreateWallet("123456", "mywallet");
destreamReceiver.FullNode.WalletManager().CreateWallet("123456", "mywallet");
HdAddress addr = stratisSender.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
Wallet wallet = stratisSender.FullNode.WalletManager().GetWalletByName("mywallet");
HdAddress addr = destreamSender.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
Wallet wallet = destreamSender.FullNode.WalletManager().GetWalletByName("mywallet");
Key key = wallet.GetExtendedPrivateKeyForAddress("123456", addr).PrivateKey;
stratisSender.SetDummyMinerSecret(new BitcoinSecret(key, stratisSender.FullNode.Network));
int maturity = (int)stratisSender.FullNode.Network.Consensus.Option<PowConsensusOptions>().CoinbaseMaturity;
stratisSender.GenerateDeStreamWithMiner(maturity + 51);
destreamSender.SetDummyMinerSecret(new BitcoinSecret(key, destreamSender.FullNode.Network));
int maturity = (int)destreamSender.FullNode.Network.Consensus.Option<PowConsensusOptions>().CoinbaseMaturity;
destreamSender.GenerateDeStreamWithMiner(maturity + 51);
// Wait for block repo for block sync to work.
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
Assert.Equal(Money.COIN * 150 * 50, stratisSender.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount));
Assert.Equal(Money.COIN * 150 * 50, destreamSender.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount));
// Sync both nodes.
stratisSender.CreateRPCClient().AddNode(stratisReceiver.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
destreamSender.CreateRPCClient().AddNode(destreamReceiver.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
// Get 50 unused addresses from the receiver.
IEnumerable<HdAddress> recevierAddresses = stratisReceiver.FullNode.WalletManager()
IEnumerable<HdAddress> recevierAddresses = destreamReceiver.FullNode.WalletManager()
.GetUnusedAddresses(new WalletAccountReference("mywallet", "account 0"), 50);
List<Recipient> recipients = recevierAddresses.Select(address => new Recipient
......@@ -144,28 +144,28 @@ namespace DeStream.Bitcoin.IntegrationTests
MinConfirmations = 101
};
Transaction transaction = stratisSender.FullNode.WalletTransactionHandler().BuildTransaction(transactionBuildContext);
Transaction transaction = destreamSender.FullNode.WalletTransactionHandler().BuildTransaction(transactionBuildContext);
Assert.Equal(51, transaction.Outputs.Count);
// Broadcast to the other node.
stratisSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(transaction.ToHex()));
destreamSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(transaction.ToHex()));
// Wait for the trx's to arrive.
TestHelper.WaitLoop(() => stratisReceiver.CreateRPCClient().GetRawMempool().Length > 0);
TestHelper.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any());
TestHelper.WaitLoop(() => destreamReceiver.CreateRPCClient().GetRawMempool().Length > 0);
TestHelper.WaitLoop(() => destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any());
Assert.Equal(Money.COIN * 50, stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount));
Assert.Null(stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
Assert.Equal(Money.COIN * 50, destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount));
Assert.Null(destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
// Generate new blocks so the trx is confirmed.
stratisSender.GenerateDeStreamWithMiner(1);
destreamSender.GenerateDeStreamWithMiner(1);
// Wait for block repo for block sync to work.
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
// Confirm trx's have been committed to the block.
Assert.Equal(maturity + 52 , stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
Assert.Equal(maturity + 52 , destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
}
}
......@@ -174,15 +174,15 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
CoreNode stratisNodeSync = builder.CreateDeStreamPowNode();
CoreNode destreamNodeSync = builder.CreateDeStreamPowNode();
builder.StartAll();
// Move a wallet file to the right folder and restart the wallet manager to take it into account.
this.InitializeTestWallet(stratisNodeSync.FullNode.DataFolder.WalletPath);
var walletManager = stratisNodeSync.FullNode.NodeService<IWalletManager>() as WalletManager;
this.InitializeTestWallet(destreamNodeSync.FullNode.DataFolder.WalletPath);
var walletManager = destreamNodeSync.FullNode.NodeService<IWalletManager>() as WalletManager;
walletManager.Start();
var rpc = stratisNodeSync.CreateRPCClient();
var rpc = destreamNodeSync.CreateRPCClient();
rpc.SendCommand(NBitcoin.RPC.RPCOperations.generate, 10);
Assert.Equal(10, rpc.GetBlockCount());
......@@ -203,151 +203,151 @@ namespace DeStream.Bitcoin.IntegrationTests
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisSender = builder.CreateDeStreamPowNode();
var stratisReceiver = builder.CreateDeStreamPowNode();
var stratisReorg = builder.CreateDeStreamPowNode();
var destreamSender = builder.CreateDeStreamPowNode();
var destreamReceiver = builder.CreateDeStreamPowNode();
var destreamReorg = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisSender.NotInIBD();
stratisReceiver.NotInIBD();
stratisReorg.NotInIBD();
destreamSender.NotInIBD();
destreamReceiver.NotInIBD();
destreamReorg.NotInIBD();
// get a key from the wallet
var mnemonic1 = stratisSender.FullNode.WalletManager().CreateWallet("123456", "mywallet");
var mnemonic2 = stratisReceiver.FullNode.WalletManager().CreateWallet("123456", "mywallet");
var mnemonic1 = destreamSender.FullNode.WalletManager().CreateWallet("123456", "mywallet");
var mnemonic2 = destreamReceiver.FullNode.WalletManager().CreateWallet("123456", "mywallet");
Assert.Equal(12, mnemonic1.Words.Length);
Assert.Equal(12, mnemonic2.Words.Length);
var addr = stratisSender.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var wallet = stratisSender.FullNode.WalletManager().GetWalletByName("mywallet");
var addr = destreamSender.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var wallet = destreamSender.FullNode.WalletManager().GetWalletByName("mywallet");
var key = wallet.GetExtendedPrivateKeyForAddress("123456", addr).PrivateKey;
stratisSender.SetDummyMinerSecret(new BitcoinSecret(key, stratisSender.FullNode.Network));
stratisReorg.SetDummyMinerSecret(new BitcoinSecret(key, stratisSender.FullNode.Network));
destreamSender.SetDummyMinerSecret(new BitcoinSecret(key, destreamSender.FullNode.Network));
destreamReorg.SetDummyMinerSecret(new BitcoinSecret(key, destreamSender.FullNode.Network));
var maturity = (int)stratisSender.FullNode.Network.Consensus.Option<PowConsensusOptions>().CoinbaseMaturity;
stratisSender.GenerateDeStreamWithMiner(maturity + 15);
var maturity = (int)destreamSender.FullNode.Network.Consensus.Option<PowConsensusOptions>().CoinbaseMaturity;
destreamSender.GenerateDeStreamWithMiner(maturity + 15);
var currentBestHeight = maturity + 15;
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
// the mining should add coins to the wallet
var total = stratisSender.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
var total = destreamSender.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
Assert.Equal(Money.COIN * currentBestHeight * 50, total);
// sync all nodes
stratisReceiver.CreateRPCClient().AddNode(stratisSender.Endpoint, true);
stratisReceiver.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
stratisSender.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg));
destreamReceiver.CreateRPCClient().AddNode(destreamSender.Endpoint, true);
destreamReceiver.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
destreamSender.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamReorg));
// Build Transaction 1
// ====================
// send coins to the receiver
var sendto = stratisReceiver.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var transaction1 = stratisSender.FullNode.WalletTransactionHandler().BuildTransaction(CreateContext(new WalletAccountReference("mywallet", "account 0"), "123456", sendto.ScriptPubKey, Money.COIN * 100, FeeType.Medium, 101));
var sendto = destreamReceiver.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var transaction1 = destreamSender.FullNode.WalletTransactionHandler().BuildTransaction(CreateContext(new WalletAccountReference("mywallet", "account 0"), "123456", sendto.ScriptPubKey, Money.COIN * 100, FeeType.Medium, 101));
// broadcast to the other node
stratisSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(transaction1.ToHex()));
destreamSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(transaction1.ToHex()));
// wait for the trx to arrive
TestHelper.WaitLoop(() => stratisReceiver.CreateRPCClient().GetRawMempool().Length > 0);
Assert.NotNull(stratisReceiver.CreateRPCClient().GetRawTransaction(transaction1.GetHash(), false));
TestHelper.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any());
TestHelper.WaitLoop(() => destreamReceiver.CreateRPCClient().GetRawMempool().Length > 0);
Assert.NotNull(destreamReceiver.CreateRPCClient().GetRawTransaction(transaction1.GetHash(), false));
TestHelper.WaitLoop(() => destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any());
var receivetotal = stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
var receivetotal = destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
Assert.Equal(Money.COIN * 100, receivetotal);
Assert.Null(stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
Assert.Null(destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
// generate two new blocks so the trx is confirmed
stratisSender.GenerateDeStreamWithMiner(1);
destreamSender.GenerateDeStreamWithMiner(1);
var transaction1MinedHeight = currentBestHeight + 1;
stratisSender.GenerateDeStreamWithMiner(1);
destreamSender.GenerateDeStreamWithMiner(1);
currentBestHeight = currentBestHeight + 2;
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg));
Assert.Equal(currentBestHeight, stratisReceiver.FullNode.Chain.Tip.Height);
TestHelper.WaitLoop(() => transaction1MinedHeight == stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamReorg));
Assert.Equal(currentBestHeight, destreamReceiver.FullNode.Chain.Tip.Height);
TestHelper.WaitLoop(() => transaction1MinedHeight == destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
// Build Transaction 2
// ====================
// remove the reorg node
stratisReceiver.CreateRPCClient().RemoveNode(stratisReorg.Endpoint);
stratisSender.CreateRPCClient().RemoveNode(stratisReorg.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(stratisReorg));
var forkblock = stratisReceiver.FullNode.Chain.Tip;
destreamReceiver.CreateRPCClient().RemoveNode(destreamReorg.Endpoint);
destreamSender.CreateRPCClient().RemoveNode(destreamReorg.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(destreamReorg));
var forkblock = destreamReceiver.FullNode.Chain.Tip;
// send more coins to the wallet
sendto = stratisReceiver.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var transaction2 = stratisSender.FullNode.WalletTransactionHandler().BuildTransaction(CreateContext(new WalletAccountReference("mywallet", "account 0"), "123456", sendto.ScriptPubKey, Money.COIN * 10, FeeType.Medium, 101));
stratisSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(transaction2.ToHex()));
sendto = destreamReceiver.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var transaction2 = destreamSender.FullNode.WalletTransactionHandler().BuildTransaction(CreateContext(new WalletAccountReference("mywallet", "account 0"), "123456", sendto.ScriptPubKey, Money.COIN * 10, FeeType.Medium, 101));
destreamSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(transaction2.ToHex()));
// wait for the trx to arrive
TestHelper.WaitLoop(() => stratisReceiver.CreateRPCClient().GetRawMempool().Length > 0);
Assert.NotNull(stratisReceiver.CreateRPCClient().GetRawTransaction(transaction2.GetHash(), false));
TestHelper.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any());
var newamount = stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
TestHelper.WaitLoop(() => destreamReceiver.CreateRPCClient().GetRawMempool().Length > 0);
Assert.NotNull(destreamReceiver.CreateRPCClient().GetRawTransaction(transaction2.GetHash(), false));
TestHelper.WaitLoop(() => destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any());
var newamount = destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
Assert.Equal(Money.COIN * 110, newamount);
Assert.Contains(stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet"), b => b.Transaction.BlockHeight == null);
Assert.Contains(destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet"), b => b.Transaction.BlockHeight == null);
// mine more blocks so its included in the chain
stratisSender.GenerateDeStreamWithMiner(1);
destreamSender.GenerateDeStreamWithMiner(1);
var transaction2MinedHeight = currentBestHeight + 1;
stratisSender.GenerateDeStreamWithMiner(1);
destreamSender.GenerateDeStreamWithMiner(1);
currentBestHeight = currentBestHeight + 2;
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
Assert.Equal(currentBestHeight, stratisReceiver.FullNode.Chain.Tip.Height);
TestHelper.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any(b => b.Transaction.BlockHeight == transaction2MinedHeight));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
Assert.Equal(currentBestHeight, destreamReceiver.FullNode.Chain.Tip.Height);
TestHelper.WaitLoop(() => destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any(b => b.Transaction.BlockHeight == transaction2MinedHeight));
// create a reorg by mining on two different chains
// ================================================
// advance both chains, one chin is longer
stratisSender.GenerateDeStreamWithMiner(2);
stratisReorg.GenerateDeStreamWithMiner(10);
destreamSender.GenerateDeStreamWithMiner(2);
destreamReorg.GenerateDeStreamWithMiner(10);
currentBestHeight = forkblock.Height + 10;
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisReorg));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamReorg));
// connect the reorg chain
stratisReceiver.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
stratisSender.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
destreamReceiver.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
destreamSender.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
// wait for the chains to catch up
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg));
Assert.Equal(currentBestHeight, stratisReceiver.FullNode.Chain.Tip.Height);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamReorg));
Assert.Equal(currentBestHeight, destreamReceiver.FullNode.Chain.Tip.Height);
// ensure wallet reorg complete
TestHelper.WaitLoop(() => stratisReceiver.FullNode.WalletManager().WalletTipHash == stratisReorg.CreateRPCClient().GetBestBlockHash());
TestHelper.WaitLoop(() => destreamReceiver.FullNode.WalletManager().WalletTipHash == destreamReorg.CreateRPCClient().GetBestBlockHash());
// check the wallet amount was rolled back
var newtotal = stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
var newtotal = destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
Assert.Equal(receivetotal, newtotal);
TestHelper.WaitLoop(() => maturity + 16 == stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
TestHelper.WaitLoop(() => maturity + 16 == destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").First().Transaction.BlockHeight);
// ReBuild Transaction 2
// ====================
// After the reorg transaction2 was returned back to mempool
stratisSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(transaction2.ToHex()));
destreamSender.FullNode.NodeService<WalletController>().SendTransaction(new SendTransactionRequest(transaction2.ToHex()));
TestHelper.WaitLoop(() => stratisReceiver.CreateRPCClient().GetRawMempool().Length > 0);
TestHelper.WaitLoop(() => destreamReceiver.CreateRPCClient().GetRawMempool().Length > 0);
// mine the transaction again
stratisSender.GenerateDeStreamWithMiner(1);
destreamSender.GenerateDeStreamWithMiner(1);
transaction2MinedHeight = currentBestHeight + 1;
stratisSender.GenerateDeStreamWithMiner(1);
destreamSender.GenerateDeStreamWithMiner(1);
currentBestHeight = currentBestHeight + 2;
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg));
Assert.Equal(currentBestHeight, stratisReceiver.FullNode.Chain.Tip.Height);
var newsecondamount = stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamReorg));
Assert.Equal(currentBestHeight, destreamReceiver.FullNode.Chain.Tip.Height);
var newsecondamount = destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
Assert.Equal(newamount, newsecondamount);
TestHelper.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any(b => b.Transaction.BlockHeight == transaction2MinedHeight));
TestHelper.WaitLoop(() => destreamReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Any(b => b.Transaction.BlockHeight == transaction2MinedHeight));
}
}
......@@ -356,60 +356,60 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisSender = builder.CreateDeStreamPowNode();
var stratisReceiver = builder.CreateDeStreamPowNode();
var stratisReorg = builder.CreateDeStreamPowNode();
var destreamSender = builder.CreateDeStreamPowNode();
var destreamReceiver = builder.CreateDeStreamPowNode();
var destreamReorg = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisSender.NotInIBD();
stratisReceiver.NotInIBD();
stratisReorg.NotInIBD();
destreamSender.NotInIBD();
destreamReceiver.NotInIBD();
destreamReorg.NotInIBD();
stratisSender.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisSender.FullNode.Network));
stratisReorg.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisReorg.FullNode.Network));
destreamSender.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamSender.FullNode.Network));
destreamReorg.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamReorg.FullNode.Network));
stratisSender.GenerateDeStreamWithMiner(10);
destreamSender.GenerateDeStreamWithMiner(10);
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
//// sync all nodes
stratisReceiver.CreateRPCClient().AddNode(stratisSender.Endpoint, true);
stratisReceiver.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
stratisSender.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg));
destreamReceiver.CreateRPCClient().AddNode(destreamSender.Endpoint, true);
destreamReceiver.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
destreamSender.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamReorg));
// remove the reorg node
stratisReceiver.CreateRPCClient().RemoveNode(stratisReorg.Endpoint);
stratisSender.CreateRPCClient().RemoveNode(stratisReorg.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(stratisReorg));
destreamReceiver.CreateRPCClient().RemoveNode(destreamReorg.Endpoint);
destreamSender.CreateRPCClient().RemoveNode(destreamReorg.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(destreamReorg));
// create a reorg by mining on two different chains
// ================================================
// advance both chains, one chin is longer
stratisSender.GenerateDeStreamWithMiner(2);
stratisReorg.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisReorg));
destreamSender.GenerateDeStreamWithMiner(2);
destreamReorg.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamReorg));
// rewind the wallet in the stratisReceiver node
(stratisReceiver.FullNode.NodeService<IWalletSyncManager>() as WalletSyncManager).SyncFromHeight(5);
// rewind the wallet in the destreamReceiver node
(destreamReceiver.FullNode.NodeService<IWalletSyncManager>() as WalletSyncManager).SyncFromHeight(5);
// connect the reorg chain
stratisReceiver.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
stratisSender.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
destreamReceiver.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
destreamSender.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
// wait for the chains to catch up
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg));
Assert.Equal(20, stratisReceiver.FullNode.Chain.Tip.Height);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamReorg));
Assert.Equal(20, destreamReceiver.FullNode.Chain.Tip.Height);
stratisSender.GenerateDeStreamWithMiner(5);
destreamSender.GenerateDeStreamWithMiner(5);
TestHelper.TriggerSync(stratisReceiver);
TestHelper.TriggerSync(stratisSender);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
Assert.Equal(25, stratisReceiver.FullNode.Chain.Tip.Height);
TestHelper.TriggerSync(destreamReceiver);
TestHelper.TriggerSync(destreamSender);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
Assert.Equal(25, destreamReceiver.FullNode.Chain.Tip.Height);
}
}
......@@ -418,58 +418,58 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisSender = builder.CreateDeStreamPowNode();
var stratisReceiver = builder.CreateDeStreamPowNode();
var stratisReorg = builder.CreateDeStreamPowNode();
var destreamSender = builder.CreateDeStreamPowNode();
var destreamReceiver = builder.CreateDeStreamPowNode();
var destreamReorg = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisSender.NotInIBD();
stratisReceiver.NotInIBD();
stratisReorg.NotInIBD();
destreamSender.NotInIBD();
destreamReceiver.NotInIBD();
destreamReorg.NotInIBD();
stratisSender.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisSender.FullNode.Network));
stratisReorg.SetDummyMinerSecret(new BitcoinSecret(new Key(), stratisReorg.FullNode.Network));
destreamSender.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamSender.FullNode.Network));
destreamReorg.SetDummyMinerSecret(new BitcoinSecret(new Key(), destreamReorg.FullNode.Network));
stratisSender.GenerateDeStreamWithMiner(10);
destreamSender.GenerateDeStreamWithMiner(10);
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
//// sync all nodes
stratisReceiver.CreateRPCClient().AddNode(stratisSender.Endpoint, true);
stratisReceiver.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
stratisSender.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg));
destreamReceiver.CreateRPCClient().AddNode(destreamSender.Endpoint, true);
destreamReceiver.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
destreamSender.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamReorg));
// remove the reorg node and wait for node to be disconnected
stratisReceiver.CreateRPCClient().RemoveNode(stratisReorg.Endpoint);
stratisSender.CreateRPCClient().RemoveNode(stratisReorg.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(stratisReorg));
destreamReceiver.CreateRPCClient().RemoveNode(destreamReorg.Endpoint);
destreamSender.CreateRPCClient().RemoveNode(destreamReorg.Endpoint);
TestHelper.WaitLoop(() => !TestHelper.IsNodeConnected(destreamReorg));
// create a reorg by mining on two different chains
// ================================================
// advance both chains, one chin is longer
stratisSender.GenerateDeStreamWithMiner(2);
stratisReorg.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisReorg));
destreamSender.GenerateDeStreamWithMiner(2);
destreamReorg.GenerateDeStreamWithMiner(10);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamSender));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamReorg));
// connect the reorg chain
stratisReceiver.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
stratisSender.CreateRPCClient().AddNode(stratisReorg.Endpoint, true);
destreamReceiver.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
destreamSender.CreateRPCClient().AddNode(destreamReorg.Endpoint, true);
// wait for the chains to catch up
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg));
Assert.Equal(20, stratisReceiver.FullNode.Chain.Tip.Height);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamReorg));
Assert.Equal(20, destreamReceiver.FullNode.Chain.Tip.Height);
// rewind the wallet in the stratisReceiver node
(stratisReceiver.FullNode.NodeService<IWalletSyncManager>() as WalletSyncManager).SyncFromHeight(10);
// rewind the wallet in the destreamReceiver node
(destreamReceiver.FullNode.NodeService<IWalletSyncManager>() as WalletSyncManager).SyncFromHeight(10);
stratisSender.GenerateDeStreamWithMiner(5);
destreamSender.GenerateDeStreamWithMiner(5);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender));
Assert.Equal(25, stratisReceiver.FullNode.Chain.Tip.Height);
TestHelper.WaitLoop(() => TestHelper.AreNodesSynced(destreamReceiver, destreamSender));
Assert.Equal(25, destreamReceiver.FullNode.Chain.Tip.Height);
}
}
......@@ -478,29 +478,29 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisminer = builder.CreateDeStreamPowNode();
var destreamminer = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisminer.NotInIBD();
destreamminer.NotInIBD();
// get a key from the wallet
var mnemonic = stratisminer.FullNode.WalletManager().CreateWallet("123456", "mywallet");
var mnemonic = destreamminer.FullNode.WalletManager().CreateWallet("123456", "mywallet");
Assert.Equal(12, mnemonic.Words.Length);
var addr = stratisminer.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var wallet = stratisminer.FullNode.WalletManager().GetWalletByName("mywallet");
var addr = destreamminer.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var wallet = destreamminer.FullNode.WalletManager().GetWalletByName("mywallet");
var key = wallet.GetExtendedPrivateKeyForAddress("123456", addr).PrivateKey;
stratisminer.SetDummyMinerSecret(key.GetBitcoinSecret(stratisminer.FullNode.Network));
stratisminer.GenerateDeStream(10);
destreamminer.SetDummyMinerSecret(key.GetBitcoinSecret(destreamminer.FullNode.Network));
destreamminer.GenerateDeStream(10);
// wait for block repo for block sync to work
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisminer));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamminer));
// push the wallet back
stratisminer.FullNode.Services.ServiceProvider.GetService<IWalletSyncManager>().SyncFromHeight(5);
destreamminer.FullNode.Services.ServiceProvider.GetService<IWalletSyncManager>().SyncFromHeight(5);
stratisminer.GenerateDeStream(5);
destreamminer.GenerateDeStream(5);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisminer));
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamminer));
}
}
......@@ -509,28 +509,28 @@ namespace DeStream.Bitcoin.IntegrationTests
{
using (NodeBuilder builder = NodeBuilder.Create())
{
var stratisNodeSync = builder.CreateDeStreamPowNode();
var destreamNodeSync = builder.CreateDeStreamPowNode();
builder.StartAll();
stratisNodeSync.NotInIBD();
destreamNodeSync.NotInIBD();
// get a key from the wallet
var mnemonic = stratisNodeSync.FullNode.WalletManager().CreateWallet("123456", "mywallet");
var mnemonic = destreamNodeSync.FullNode.WalletManager().CreateWallet("123456", "mywallet");
Assert.Equal(12, mnemonic.Words.Length);
var addr = stratisNodeSync.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var wallet = stratisNodeSync.FullNode.WalletManager().GetWalletByName("mywallet");
var addr = destreamNodeSync.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
var wallet = destreamNodeSync.FullNode.WalletManager().GetWalletByName("mywallet");
var key = wallet.GetExtendedPrivateKeyForAddress("123456", addr).PrivateKey;
stratisNodeSync.SetDummyMinerSecret(key.GetBitcoinSecret(stratisNodeSync.FullNode.Network));
stratisNodeSync.GenerateDeStream(10);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisNodeSync));
destreamNodeSync.SetDummyMinerSecret(key.GetBitcoinSecret(destreamNodeSync.FullNode.Network));
destreamNodeSync.GenerateDeStream(10);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(destreamNodeSync));
// set the tip of best chain some blocks in the apst
stratisNodeSync.FullNode.Chain.SetTip(stratisNodeSync.FullNode.Chain.GetBlock(stratisNodeSync.FullNode.Chain.Height - 5));
destreamNodeSync.FullNode.Chain.SetTip(destreamNodeSync.FullNode.Chain.GetBlock(destreamNodeSync.FullNode.Chain.Height - 5));
// stop the node it will persist the chain with the reset tip
stratisNodeSync.FullNode.Dispose();
destreamNodeSync.FullNode.Dispose();
var newNodeInstance = builder.CloneDeStreamNode(stratisNodeSync);
var newNodeInstance = builder.CloneDeStreamNode(destreamNodeSync);
// load the node, this should hit the block store recover code
newNodeInstance.Start();
......
......@@ -27,7 +27,7 @@ namespace DeStream.Bitcoin.Utilities
/// <returns><c>true</c> if the specified network is bitcoin, <c>false</c> otherwise.</returns>
public static bool IsBitcoin(this Network network)
{
return !network.Name.ToLowerInvariant().Contains("stratis");
return !network.Name.ToLowerInvariant().Contains("destream");
}
}
}
cd ..
start cmd /k dotnet run
timeout 21
start cmd /k dotnet run stratis
\ No newline at end of file
start cmd /k dotnet run destream
cd ..
start cmd /k dotnet run -testnet -debug=all -loglevel=debug
timeout 21
start cmd /k dotnet run stratis -testnet -debug=all -loglevel=debug
\ No newline at end of file
start cmd /k dotnet run destream -testnet -debug=all -loglevel=debug
......@@ -26,7 +26,7 @@ namespace DeStream.BreezeD
{
// Get the API uri.
var isTestNet = args.Contains("-testnet");
var isDeStream = args.Contains("stratis");
var isDeStream = args.Contains("destream");
var isDestreamTest = args.Contains("-destreamtest");
var agent = "Breeze";
......
......@@ -10,11 +10,11 @@
},
"DeStream Main": {
"commandName": "Project",
"commandLineArgs": "stratis "
"commandLineArgs": "destream "
},
"DeStream Test": {
"commandName": "Project",
"commandLineArgs": "stratis -testnet -debug=all -loglevel=debug"
"commandLineArgs": "destream -testnet -debug=all -loglevel=debug"
}
}
}
\ No newline at end of file
......@@ -5,11 +5,11 @@
},
"DeStream.DeStreamDnsD Test": {
"commandName": "Project",
"commandLineArgs": "-testnet -dnslistenport=5399 -dnshostname=dns.stratisplatform.com -dnsnameserver=ns1.dns.stratisplatform.com -dnsmailbox=admin@stratisplatform.com"
"commandLineArgs": "-testnet -dnslistenport=5399 -dnshostname=dns.destreamplatform.com -dnsnameserver=ns1.dns.destreamplatform.com -dnsmailbox=admin@destreamplatform.com"
},
"DeStream.DeStreamDnsD FullNode Test": {
"commandName": "Project",
"commandLineArgs": "-testnet -dnsfullnode -dnslistenport=5399 -dnshostname=dns.stratisplatform.com -dnsnameserver=ns1.dns.stratisplatform.com -dnsmailbox=admin@stratisplatform.com"
"commandLineArgs": "-testnet -dnsfullnode -dnslistenport=5399 -dnshostname=dns.destreamplatform.com -dnsnameserver=ns1.dns.destreamplatform.com -dnsmailbox=admin@destreamplatform.com"
}
}
}
\ No newline at end of file
......@@ -13,7 +13,7 @@ using NBitcoin.RPC;
namespace NBitcoin.Tests
{
// Require a stratis node running with the following stratis.conf file
// Require a destream node running with the following destream.conf file
//server=1
//rpcuser=rpcuser
//rpcpassword = rpcpassword
......@@ -111,8 +111,8 @@ namespace NBitcoin.Tests
public void StartAll()
{
if (!Process.GetProcesses().Any(p => p.ProcessName.Contains("stratis")))
throw new NotSupportedException("stratis node is not running");
if (!Process.GetProcesses().Any(p => p.ProcessName.Contains("destream")))
throw new NotSupportedException("destream node is not running");
//Task.WaitAll(Nodes.Where(n => n.State == CoreNodeState.Stopped).Select(n => n.StartAsync()).ToArray());
}
......
......@@ -14,7 +14,7 @@ namespace NBitcoin.Tests
/*
* TODO: Consider importing to FN.
public static bool noClient = !Process.GetProcesses().Any(p => p.ProcessName.Contains("stratis"));
public static bool noClient = !Process.GetProcesses().Any(p => p.ProcessName.Contains("destream"));
[Fact]
[Trait("UnitTest", "UnitTest")]
......
......@@ -15,7 +15,7 @@ namespace NBitcoin.Tests
[Trait("RPCClient", "RPCClient")]
public class pos_RPCClientTests
{
public static bool noClient = !Process.GetProcesses().Any(p => p.ProcessName.Contains("stratis"));
public static bool noClient = !Process.GetProcesses().Any(p => p.ProcessName.Contains("destream"));
private const string TestAccount = "NBitcoin.RPCClientTests";
public pos_RPCClientTests()
......
......@@ -2418,7 +2418,7 @@ namespace NBitcoin.Tests
private void tx_valid()
{
// test is disabled for now
// todo: get test data for the stratis blockchain
// todo: get test data for the destream blockchain
// Read tests from test/data/tx_valid.json
// Format is an array of arrays
......@@ -2539,7 +2539,7 @@ namespace NBitcoin.Tests
private void tx_invalid()
{
// test is disabled for now
// todo: get test data for the stratis blockchain
// todo: get test data for the destream blockchain
// Read tests from test/data/tx_valid.json
// Format is an array of arrays
......
......@@ -282,7 +282,7 @@ namespace NBitcoin
public string Name { get; private set; }
/// <summary> The name of the root folder containing blockchains operating with the same consensus rules (for now, this will be bitcoin or stratis). </summary>
/// <summary> The name of the root folder containing blockchains operating with the same consensus rules (for now, this will be bitcoin or destream). </summary>
public string RootFolderName { get; private set; }
/// <summary> The default name used for the network configuration file. </summary>
......
......@@ -45,10 +45,10 @@ namespace NBitcoin
public const string BitcoinDefaultConfigFilename = "bitcoin.conf";
/// <summary> The name of the root folder containing the different DeStream blockchains (DeStreamMain, DeStreamTest, DeStreamRegTest). </summary>
public const string DeStreamRootFolderName = "stratis";
public const string DeStreamRootFolderName = "destream";
/// <summary> The default name used for the DeStream configuration file. </summary>
public const string DeStreamDefaultConfigFilename = "stratis.conf";
public const string DeStreamDefaultConfigFilename = "destream.conf";
public static Network Main => Network.GetNetwork("Main") ?? InitMain();
......@@ -379,10 +379,10 @@ namespace NBitcoin
.AddDNSSeeds(new[]
{
new DNSSeedData("seednode1.stratisplatform.com", "seednode1.stratisplatform.com"),
new DNSSeedData("seednode2.stratis.cloud", "seednode2.stratis.cloud"),
new DNSSeedData("seednode3.stratisplatform.com", "seednode3.stratisplatform.com"),
new DNSSeedData("seednode4.stratis.cloud", "seednode4.stratis.cloud")
new DNSSeedData("seednode1.destreamplatform.com", "seednode1.destreamplatform.com"),
new DNSSeedData("seednode2.destream.cloud", "seednode2.destream.cloud"),
new DNSSeedData("seednode3.destreamplatform.com", "seednode3.destreamplatform.com"),
new DNSSeedData("seednode4.destream.cloud", "seednode4.destream.cloud")
})
.SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] { (63) })
......@@ -471,10 +471,10 @@ namespace NBitcoin
.AddDNSSeeds(new[]
{
new DNSSeedData("testnet1.stratisplatform.com", "testnet1.stratisplatform.com"),
new DNSSeedData("testnet2.stratisplatform.com", "testnet2.stratisplatform.com"),
new DNSSeedData("testnet3.stratisplatform.com", "testnet3.stratisplatform.com"),
new DNSSeedData("testnet4.stratisplatform.com", "testnet4.stratisplatform.com")
new DNSSeedData("testnet1.destreamplatform.com", "testnet1.destreamplatform.com"),
new DNSSeedData("testnet2.destreamplatform.com", "testnet2.destreamplatform.com"),
new DNSSeedData("testnet3.destreamplatform.com", "testnet3.destreamplatform.com"),
new DNSSeedData("testnet4.destreamplatform.com", "testnet4.destreamplatform.com")
});
builder.AddSeeds(new[]
......
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