Skip to content

Commit

Permalink
Networkz (#22)
Browse files Browse the repository at this point in the history
* using Apex throughout solution

* removed unused assert method in Networks

* remove left behind

* remove extra space
  • Loading branch information
bokobza authored and monsieurleberre committed Jun 13, 2018
1 parent 406fbb2 commit 248482f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
25 changes: 12 additions & 13 deletions SidechainFunder_Can.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
using WtTransactionBuildContext = Stratis.Bitcoin.Features.Wallet.TransactionBuildContext;
using System;
using Stratis.Bitcoin.IntegrationTests.Common;
using Stratis.Networks.Apex;
using Stratis.Sidechains.Features.BlockchainGeneration;
using Stratis.Sidechains.Networks;

//todo: this is pre-refactoring code
//todo: ensure no duplicate or fake withdrawal or deposit transactions are possible (current work underway)
Expand All @@ -57,7 +56,7 @@ public class FedMember
public class SidechainFunder_Can
{
private List<FedMember> members;
private readonly Network sidechainNetwork = SidechainNetwork.SidechainTest;
private readonly Network sidechainNetwork = ApexNetwork.Test;
private readonly Network mainchainNetwork = Network.StratisRegTest;

public void CreateMembers()
Expand Down Expand Up @@ -315,7 +314,7 @@ public void CreateMembers()

// Create a wallet and add our multi-sig.
await ApiCalls.CreateGeneralPurposeWallet(sidechainNode_Member1_Wallet.GetApiPort(), "multisig_wallet", "password");
var account_member1 = fedFolder.ImportPrivateKeyToWallet(sidechainNode_Member1_Wallet, "multisig_wallet", "password", "member1", "pass1", 2, 3, SidechainNetwork.SidechainRegTest);
var account_member1 = fedFolder.ImportPrivateKeyToWallet(sidechainNode_Member1_Wallet, "multisig_wallet", "password", "member1", "pass1", 2, 3, ApexNetwork.RegTest);

// UCInit: The actor navigates to an initialize sidechain feature. He enters the multi-sig
// quorum parameters (eg 12 of 20) and enters the folder location (federation folder)
Expand Down Expand Up @@ -478,7 +477,7 @@ public void CreateMembers()

// First we'll need to mine more blocks on the multi-sig so we can spend mature funds.
var powMinting_Sidechain = sidechainNode_Member1_Wallet.FullNode.NodeService<IPowMining>();
bitcoinAddress = new BitcoinPubKeyAddress(addressSidechain, SidechainNetwork.SidechainRegTest);
bitcoinAddress = new BitcoinPubKeyAddress(addressSidechain, ApexNetwork.RegTest);
powMinting_Sidechain.GenerateBlocks(new ReserveScript(bitcoinAddress.ScriptPubKey), 50UL, int.MaxValue);

await IntegrationTestUtils.WaitLoop(() => IntegrationTestUtils.AreNodesSynced(sidechainNode_FunderRole, sidechainNode_Member1_Wallet));
Expand Down Expand Up @@ -743,15 +742,15 @@ public void CreateMembers()
//create wallets on the sidechains
//sidechain_FederationGateway1
await ApiCalls.CreateGeneralPurposeWallet(sidechain_FederationGateway1.GetApiPort(), "multisig_wallet", "password");
var account_fed_member1_sidechain = fedFolder.ImportPrivateKeyToWallet(sidechain_FederationGateway1, "multisig_wallet", "password", "member1", "pass1", 2, 3, SidechainNetwork.SidechainRegTest);
var account_fed_member1_sidechain = fedFolder.ImportPrivateKeyToWallet(sidechain_FederationGateway1, "multisig_wallet", "password", "member1", "pass1", 2, 3, ApexNetwork.RegTest);

//sidechain_FederationGateway2
await ApiCalls.CreateGeneralPurposeWallet(sidechain_FederationGateway2.GetApiPort(), "multisig_wallet", "password");
var account_fed_member2_sidechain = fedFolder.ImportPrivateKeyToWallet(sidechain_FederationGateway2, "multisig_wallet", "password", "member2", "pass2", 2, 3, SidechainNetwork.SidechainRegTest);
var account_fed_member2_sidechain = fedFolder.ImportPrivateKeyToWallet(sidechain_FederationGateway2, "multisig_wallet", "password", "member2", "pass2", 2, 3, ApexNetwork.RegTest);

//sidechain_FederationGateway3
await ApiCalls.CreateGeneralPurposeWallet(sidechain_FederationGateway3.GetApiPort(), "multisig_wallet", "password");
var account_fed_member3_sidechain = fedFolder.ImportPrivateKeyToWallet(sidechain_FederationGateway3, "multisig_wallet", "password", "member3", "pass3", 2, 3, SidechainNetwork.SidechainRegTest);
var account_fed_member3_sidechain = fedFolder.ImportPrivateKeyToWallet(sidechain_FederationGateway3, "multisig_wallet", "password", "member3", "pass3", 2, 3, ApexNetwork.RegTest);

await Task.Delay(5000);

Expand All @@ -767,7 +766,7 @@ public void CreateMembers()
await IntegrationTestUtils.WaitLoop(() => IntegrationTestUtils.IsGeneralWalletSyncedToHeight(sidechain_FederationGateway2, 53));
await IntegrationTestUtils.WaitLoop(() => IntegrationTestUtils.IsGeneralWalletSyncedToHeight(sidechain_FederationGateway3, 53));

bitcoinAddress = new BitcoinPubKeyAddress(addressSidechain, SidechainNetwork.SidechainRegTest);
bitcoinAddress = new BitcoinPubKeyAddress(addressSidechain, ApexNetwork.RegTest);
powMinting_Sidechain.GenerateBlocks(new ReserveScript(bitcoinAddress.ScriptPubKey), 1UL, int.MaxValue);

await IntegrationTestUtils.WaitLoop(() => IntegrationTestUtils.AreNodesSynced(sidechain_FederationGateway1, sidechainNode_Member1_Wallet));
Expand Down Expand Up @@ -824,7 +823,7 @@ public void CreateMembers()
await IntegrationTestUtils.WaitLoop(() => IntegrationTestUtils.IsGeneralWalletSyncedToHeight(sidechain_FederationGateway2, 54));
await IntegrationTestUtils.WaitLoop(() => IntegrationTestUtils.IsGeneralWalletSyncedToHeight(sidechain_FederationGateway3, 54));

bitcoinAddress = new BitcoinPubKeyAddress(addressSidechain, SidechainNetwork.SidechainRegTest);
bitcoinAddress = new BitcoinPubKeyAddress(addressSidechain, ApexNetwork.RegTest);
powMinting_Sidechain.GenerateBlocks(new ReserveScript(bitcoinAddress.ScriptPubKey), 1UL, int.MaxValue);

await IntegrationTestUtils.WaitLoop(() => IntegrationTestUtils.AreNodesSynced(sidechain_FederationGateway1, sidechainNode_Member1_Wallet));
Expand Down Expand Up @@ -863,7 +862,7 @@ public void CreateMembers()

transactionBuildContext = new WtTransactionBuildContext(
sendingWalletAccountReference,
new List<WtRecipient>() { new WtRecipient() { Amount = new Money(2500, MoneyUnit.BTC), ScriptPubKey = BitcoinAddress.Create(multiSigAddress_Sidechain, SidechainNetwork.SidechainRegTest).ScriptPubKey } },
new List<WtRecipient>() { new WtRecipient() { Amount = new Money(2500, MoneyUnit.BTC), ScriptPubKey = BitcoinAddress.Create(multiSigAddress_Sidechain, ApexNetwork.RegTest).ScriptPubKey } },
"1234", addressMainchain)
{
MinConfirmations = 1,
Expand All @@ -877,7 +876,7 @@ public void CreateMembers()
await IntegrationTestUtils.WaitLoop(() => IntegrationTestUtils.AreNodesSynced(sidechainNode_FunderRole, sidechainNode_Member1_Wallet));

//generate a block to include our transaction
bitcoinAddress = new BitcoinPubKeyAddress(addressSidechain, SidechainNetwork.SidechainRegTest);
bitcoinAddress = new BitcoinPubKeyAddress(addressSidechain, ApexNetwork.RegTest);
powMinting_Sidechain.GenerateBlocks(new ReserveScript(bitcoinAddress.ScriptPubKey), 1UL, int.MaxValue);

await IntegrationTestUtils.WaitLoop(() => IntegrationTestUtils.AreNodesSynced(sidechain_FederationGateway1, sidechainNode_Member1_Wallet));
Expand Down Expand Up @@ -960,7 +959,7 @@ public void CreateMembers()
.UseBlockNotification()
.UseApi()
.AddRPC();
}, SidechainNetwork.SidechainRegTest, agent: "MainchainFederationGateway3v2 ");
}, ApexNetwork.RegTest, agent: "MainchainFederationGateway3v2 ");

publickey = File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "Federations\\deposit_funds_to_sidechain\\member3\\PUBLIC_mainchain_member3.txt"));
mainchain_FederationGateway3v2.ConfigParameters.Add("federationfolder", Path.Combine(Directory.GetCurrentDirectory(), "Federations\\deposit_funds_to_sidechain"));
Expand Down
5 changes: 2 additions & 3 deletions Stratis.FederatedPeg.IntegrationTests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
Expand Down Expand Up @@ -36,8 +36,7 @@
<ProjectReference Include="..\Stratis.FederatedPeg.Features.FederationGateway\Stratis.FederatedPeg.Features.FederationGateway.csproj" />
<ProjectReference Include="..\Stratis.FederatedPeg.Features.MainchainGeneratorServices\Stratis.FederatedPeg.Features.MainchainGeneratorServices.csproj" />
<ProjectReference Include="..\Stratis.FederatedPeg.Features.SidechainGeneratorServices\Stratis.FederatedPeg.Features.SidechainGeneratorServices.csproj" />
<ProjectReference Include="..\Stratis.Networks.Apex\Stratis.Networks.Apex.csproj" />
<ProjectReference Include="..\Stratis.Sidechains.Features.BlockchainGeneration\Stratis.Sidechains.Features.BlockchainGeneration.csproj" />
<ProjectReference Include="..\Stratis.Sidechains.Networks\Stratis.Sidechains.Networks.csproj" />
</ItemGroup>

</Project>

0 comments on commit 248482f

Please sign in to comment.