Commit f0168c8d authored by Pavel Pavlov's avatar Pavel Pavlov

Implementation transfer coins in in DeStream network

parent 9d4a231a
......@@ -16,6 +16,7 @@ using Stratis.Bitcoin.Features.Wallet;
using Stratis.Bitcoin.Features.Wallet.Interfaces;
using Stratis.Bitcoin.IntegrationTests.Common;
using Stratis.Bitcoin.IntegrationTests.Common.EnvironmentMockUpHelpers;
using Stratis.Bitcoin.Interfaces;
using Stratis.Bitcoin.Utilities;
namespace DeStream.DeStreamD.ForTest
......@@ -42,7 +43,7 @@ namespace DeStream.DeStreamD.ForTest
Console.WriteLine($"current network: {network.Name}");
// NOTES: running BTC and STRAT side by side is not possible yet as the flags for serialization are static
var node = new FullNodeBuilder()
IFullNode node = new FullNodeBuilder()
.UseNodeSettings(nodeSettings)
.UseBlockStore()
.UsePosConsensus()
......@@ -53,7 +54,39 @@ namespace DeStream.DeStreamD.ForTest
.AddRPC()
.Build();
//(node.NodeService<IInitialBlockDownloadState>() as InitialBlockDownloadStateMock).SetIsInitialBlockDownload(false, DateTime.UtcNow.AddMinutes(5));
//Mnemonic _mnemonic1 = node.NodeService<IWalletManager>().CreateWallet("123456", "mywallet");
//Mnemonic _mnemonic2 = node.NodeService<IWalletManager>().CreateWallet("123456", "mywallet");
//HdAddress _addr = node.NodeService<IWalletManager>().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
//Wallet _wallet = node.NodeService<IWalletManager>().GetWalletByName("mywallet");
//Key key = _wallet.GetExtendedPrivateKeyForAddress("123456", _addr).PrivateKey;
//stratisSender.SetDummyMinerSecret(new BitcoinSecret(key, stratisSender.FullNode.Network));
//int maturity = (int)stratisSender.FullNode.Network.Consensus.CoinbaseMaturity;
//stratisSender.GenerateStratis(maturity + 5);
//// wait for block repo for block sync to work
//TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
//// the mining should add coins to the wallet
//long total = stratisSender.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
//var walletManager = ((FullNode)node).NodeService<IWalletManager>() as WalletManager;
////HdAddress addr = ((FullNode)node).WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
//walletManager.CreateWallet("123456", "mywallet");
//HdAddress sendto = walletManager.GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
//var walletTransactionHandler = ((FullNode)node).NodeService<IWalletTransactionHandler>() as WalletTransactionHandler;
//var transactionBuildContext = CreateContext(
// new WalletAccountReference("mywallet", "account 0"), "123456", sendto.ScriptPubKey, Money.COIN * 100, FeeType.Medium, 101);
//Transaction trx = walletTransactionHandler.BuildTransaction(transactionBuildContext);
int qwe = 1;
NodeBuilder builder = NodeBuilder.Create(node);
CoreNode stratisSender = builder.CreateStratisPowNode();
CoreNode stratisReceiver = builder.CreateStratisPowNode();
......@@ -78,8 +111,10 @@ namespace DeStream.DeStreamD.ForTest
// the mining should add coins to the wallet
long total = stratisSender.FullNode.WalletManager().GetSpendableTransactionsInWallet("mywallet").Sum(s => s.Transaction.Amount);
var walletManager = stratisSender.FullNode.NodeService<IWalletManager>() as WalletManager;
//var walletManager1 = ((FullNode)node).NodeService<IWalletManager>() as WalletManager;
var walletManager = ((FullNode)node).NodeService<IWalletManager>() as WalletManager;
//HdAddress addr = ((FullNode)node).WalletManager().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
walletManager.CreateWallet("123456", "mywallet");
HdAddress sendto = walletManager.GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
......
......@@ -2,11 +2,11 @@ regtest=1
rest=1
server=1
txindex=1
rpcuser=393d81b8e43ff157920b046ab96b19d823275a98
rpcpassword=393d81b8e43ff157920b046ab96b19d823275a98
port=10150
rpcport=11253
apiport=10345
rpcuser=72bd1ed09d10a2a2de2cdab36417713892497247
rpcpassword=72bd1ed09d10a2a2de2cdab36417713892497247
port=13167
rpcport=11254
apiport=13638
printtoconsole=1
keypool=10
agentprefix=node10150
agentprefix=node13167
__cookie__:704d1ae658fa55e1d203064e6e4c69896dd8fb8519aee6fccefbe194981a8695
\ No newline at end of file
__cookie__:ed7b9212f66c0994d74fed43687126831c6238840af33ec19ee19a2df7e14137
\ No newline at end of file
......@@ -2,11 +2,11 @@ regtest=1
rest=1
server=1
txindex=1
rpcuser=c3d3d8db189fa9f02034c87a0e4120e8bf94b7cb
rpcpassword=c3d3d8db189fa9f02034c87a0e4120e8bf94b7cb
port=12728
rpcport=10087
apiport=11140
rpcuser=24633a316c7f32e05a289d1f6cf8a6c028483b2c
rpcpassword=24633a316c7f32e05a289d1f6cf8a6c028483b2c
port=11524
rpcport=11016
apiport=13539
printtoconsole=1
keypool=10
agentprefix=node12728
agentprefix=node11524
__cookie__:e36ddf2fc6f8bc954b56ec79d81a68f144921a4e752423493f8b9d932c60234a
\ No newline at end of file
__cookie__:d5907bec5b991b8c0bb248c68e23d58c54a43da78a43dde9bc15b58becf4401e
\ No newline at end of file
......@@ -25,7 +25,6 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="NLog" Version="4.5.6" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.0.0" />
<PackageReference Include="NUnit.Runners" Version="3.8.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
</ItemGroup>
......
......@@ -19,7 +19,7 @@ namespace Stratis.Bitcoin.IntegrationTests.Common
while (!act())
{
cancel.Token.ThrowIfCancellationRequested();
Thread.Sleep(50);
//Thread.Sleep(50);
}
}
......
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