Commit 8715a99d authored by Pavel Pavlov's avatar Pavel Pavlov

Code research and analysis (Stratis)

parent 1e7757b6
...@@ -146,25 +146,34 @@ namespace DeStream.DeStreamD.ForTest ...@@ -146,25 +146,34 @@ namespace DeStream.DeStreamD.ForTest
.UseApi() .UseApi()
.AddRPC() .AddRPC()
.Build(); .Build();
Mnemonic _mnemonic1 = node.NodeService<IWalletManager>().CreateWallet("123456", "mywallet");
Wallet _wallet = node.NodeService<IWalletManager>().GetWalletByName("mywallet");
HdAddress _addr = node.NodeService<IWalletManager>().GetUnusedAddress(new WalletAccountReference("mywallet", "account 0"));
Key _key = _wallet.GetExtendedPrivateKeyForAddress("123456", _addr).PrivateKey;
var _walletTransactionHandler = ((FullNode)node).NodeService<IWalletTransactionHandler>() as WalletTransactionHandler;
TransactionBuildContext context = CreateContext(new WalletAccountReference("mywallet", "account 0"), "password", _key.PubKey.ScriptPubKey, new Money(777), FeeType.Low, 0);
Transaction transactionResult = _walletTransactionHandler.BuildTransaction(context);
int qwe = 1;
if (node != null) if (node != null)
await node.RunAsync(); await node.RunAsync();
(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"); //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;
BitcoinSecret bitcoinSecret = new BitcoinSecret(_key, node.Network); //Wallet _wallet = node.NodeService<IWalletManager>().GetWalletByName("mywallet");
//BitcoinSecret bitcoinSecret = new BitcoinSecret(_key, node.Network);
int _maturity = (int)node.Network.Consensus.CoinbaseMaturity; //int _maturity = (int)node.Network.Consensus.CoinbaseMaturity;
GenerateStratis(node, bitcoinSecret, 10); //GenerateStratis(node, bitcoinSecret, 10);
TestHelper.WaitLoop(() => TestHelper.IsNodeSynced((FullNode)node)); //TestHelper.WaitLoop(() => TestHelper.IsNodeSynced((FullNode)node));
//// wait for block repo for block sync to work //// wait for block repo for block sync to work
//TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender)); //TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
...@@ -184,8 +193,8 @@ namespace DeStream.DeStreamD.ForTest ...@@ -184,8 +193,8 @@ namespace DeStream.DeStreamD.ForTest
//Transaction trx = walletTransactionHandler.BuildTransaction(transactionBuildContext); //Transaction trx = walletTransactionHandler.BuildTransaction(transactionBuildContext);
int qwe = 1;
NodeBuilder builder = NodeBuilder.Create(node); NodeBuilder builder = NodeBuilder.Create(node);
CoreNode stratisSender = builder.CreateStratisPowNode(); CoreNode stratisSender = builder.CreateStratisPowNode();
CoreNode stratisReceiver = builder.CreateStratisPowNode(); CoreNode stratisReceiver = builder.CreateStratisPowNode();
......
...@@ -2,11 +2,11 @@ regtest=1 ...@@ -2,11 +2,11 @@ regtest=1
rest=1 rest=1
server=1 server=1
txindex=1 txindex=1
rpcuser=f8ea820eaff15b70836adb49d67e6836d3b1ce81 rpcuser=fc838d2724c71aac7fcbd4defb0b626a7b070c30
rpcpassword=f8ea820eaff15b70836adb49d67e6836d3b1ce81 rpcpassword=fc838d2724c71aac7fcbd4defb0b626a7b070c30
port=11680 port=12655
rpcport=11647 rpcport=11967
apiport=12790 apiport=12829
printtoconsole=1 printtoconsole=1
keypool=10 keypool=10
agentprefix=node11680 agentprefix=node12655
__cookie__:5ec2c47925207702410fc0fef36bf1e58d7028ae14d9010327102c9a92becc9c __cookie__:075d8aa788d270f13fdcd44d625f7229338cf7d6ac55475fbd15fb0ed8d1cee7
\ No newline at end of file \ No newline at end of file
...@@ -64,6 +64,7 @@ namespace NBitcoin.Networks ...@@ -64,6 +64,7 @@ namespace NBitcoin.Networks
this.Consensus.DefaultAssumeValid = new uint256("0x98fa6ef0bca5b431f15fd79dc6f879dc45b83ed4b1bbe933a383ef438321958e"); // 372652 this.Consensus.DefaultAssumeValid = new uint256("0x98fa6ef0bca5b431f15fd79dc6f879dc45b83ed4b1bbe933a383ef438321958e"); // 372652
Block genesis = CreateStratisGenesisBlock(this.Consensus.ConsensusFactory, 1470467000, 1831645, 0x1e0fffff, 1, Money.Zero); Block genesis = CreateStratisGenesisBlock(this.Consensus.ConsensusFactory, 1470467000, 1831645, 0x1e0fffff, 1, Money.Zero);
//Block genesis = CreateStratisGenesisBlock(this.Consensus.ConsensusFactory, 1470467000, 1831645, 0x1e0fffff, 1, Money.Coins(9000000000));
genesis.Header.Time = 1493909211; genesis.Header.Time = 1493909211;
genesis.Header.Nonce = 2433759; genesis.Header.Nonce = 2433759;
genesis.Header.Bits = this.Consensus.PowLimit; genesis.Header.Bits = this.Consensus.PowLimit;
...@@ -71,6 +72,8 @@ namespace NBitcoin.Networks ...@@ -71,6 +72,8 @@ namespace NBitcoin.Networks
this.Consensus.HashGenesisBlock = genesis.GetHash(); this.Consensus.HashGenesisBlock = genesis.GetHash();
Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9")); Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"));
//Assert(this.Consensus.HashGenesisBlock == uint256.Parse("5c69790173d48daf2a2a111e0baafb0546ebbec9a831f890ff8c7e23fe119885"));
this.Checkpoints = new Dictionary<int, CheckpointInfo> this.Checkpoints = new Dictionary<int, CheckpointInfo>
{ {
{ 0, new CheckpointInfo(new uint256("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) }, { 0, new CheckpointInfo(new uint256("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
......
...@@ -459,7 +459,8 @@ namespace Stratis.Bitcoin.IntegrationTests.Common.EnvironmentMockUpHelpers ...@@ -459,7 +459,8 @@ namespace Stratis.Bitcoin.IntegrationTests.Common.EnvironmentMockUpHelpers
var blocks = new List<Block>(); var blocks = new List<Block>();
DateTimeOffset now = this.MockTime == null ? DateTimeOffset.UtcNow : this.MockTime.Value; DateTimeOffset now = this.MockTime == null ? DateTimeOffset.UtcNow : this.MockTime.Value;
for (int i = 0; i < blockCount; i++) //for (int i = 0; i < blockCount; i++)
for (int i = 0; i < 3; i++)
{ {
uint nonce = 0; uint nonce = 0;
var block = new Block(); var block = new Block();
......
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