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
.UseApi()
.AddRPC()
.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)
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");
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
//TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(stratisSender));
......@@ -184,8 +193,8 @@ namespace DeStream.DeStreamD.ForTest
//Transaction trx = walletTransactionHandler.BuildTransaction(transactionBuildContext);
int qwe = 1;
NodeBuilder builder = NodeBuilder.Create(node);
CoreNode stratisSender = builder.CreateStratisPowNode();
CoreNode stratisReceiver = builder.CreateStratisPowNode();
......
......@@ -2,11 +2,11 @@ regtest=1
rest=1
server=1
txindex=1
rpcuser=f8ea820eaff15b70836adb49d67e6836d3b1ce81
rpcpassword=f8ea820eaff15b70836adb49d67e6836d3b1ce81
port=11680
rpcport=11647
apiport=12790
rpcuser=fc838d2724c71aac7fcbd4defb0b626a7b070c30
rpcpassword=fc838d2724c71aac7fcbd4defb0b626a7b070c30
port=12655
rpcport=11967
apiport=12829
printtoconsole=1
keypool=10
agentprefix=node11680
agentprefix=node12655
__cookie__:5ec2c47925207702410fc0fef36bf1e58d7028ae14d9010327102c9a92becc9c
\ No newline at end of file
__cookie__:075d8aa788d270f13fdcd44d625f7229338cf7d6ac55475fbd15fb0ed8d1cee7
\ No newline at end of file
[2018-07-26 08:58:57.8061 1] INFO: Stratis.Bitcoin.FullNode.Initialize Full node initialized on RegTest
[2018-07-26 08:58:57.8061 1] INFO: Stratis.Bitcoin.FullNode.Start Starting node...
[2018-07-26 08:58:58.3068 1] INFO: Stratis.Bitcoin.Base.BaseFeature+<StartChainAsync>d__26.MoveNext Loading finalized block height
[2018-07-26 08:58:58.3221 4] INFO: Stratis.Bitcoin.Base.BaseFeature+<StartChainAsync>d__26.MoveNext Loading chain
[2018-07-26 08:58:58.3221 5] INFO: Stratis.Bitcoin.Base.BaseFeature+<StartChainAsync>d__26.MoveNext Chain loaded at height 0
[2018-07-26 08:58:58.3403 4] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext FlushChain starting
[2018-07-26 08:58:58.3403 5] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext Periodic peer flush... starting
[2018-07-26 08:58:59.4163 4] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext Consensus Loop starting
[2018-07-26 08:58:59.4512 1] INFO: Stratis.Bitcoin.Features.MemoryPool.MempoolManager+<LoadPoolAsync>d__25.MoveNext Loading Memory Pool...
[2018-07-26 08:58:59.4512 5] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext MemoryPool.RelayWorker starting
[2018-07-26 08:58:59.4634 6] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext wallet persist job starting
[2018-07-26 08:58:59.4634 1] INFO: Stratis.Bitcoin.Features.Wallet.WalletSyncManager.Start WalletSyncManager initialized. Wallet at block 0.
[2018-07-26 08:59:00.2124 1] INFO: Stratis.Bitcoin.Features.RPC.RPCFeature.Initialize RPC Server listening on:
http://[::1]:11647/
http://127.0.0.1:11647/
[2018-07-26 08:59:00.2294 5] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext DiscoverPeersAsync starting
[2018-07-26 08:59:00.2294 6] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext PeerConnectorAddNode.ConnectAsync starting
[2018-07-26 08:59:00.2447 6] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext PeerConnectorDiscovery.ConnectAsync starting
[2018-07-26 08:59:00.2628 1] INFO: Stratis.Bitcoin.Connection.ConnectionManager.StartNodeServer Node listening on:
0.0.0.0:11680
[2018-07-27 13:23:55.4123 1] INFO: Stratis.Bitcoin.FullNode.Initialize Full node initialized on RegTest
[2018-07-27 13:23:55.4123 1] INFO: Stratis.Bitcoin.FullNode.Start Starting node...
[2018-07-27 13:23:55.8960 1] INFO: Stratis.Bitcoin.Base.BaseFeature+<StartChainAsync>d__26.MoveNext Loading finalized block height
[2018-07-27 13:23:55.9164 4] INFO: Stratis.Bitcoin.Base.BaseFeature+<StartChainAsync>d__26.MoveNext Loading chain
[2018-07-27 13:23:55.9164 6] INFO: Stratis.Bitcoin.Base.BaseFeature+<StartChainAsync>d__26.MoveNext Chain loaded at height 0
[2018-07-27 13:23:55.9315 4] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext FlushChain starting
[2018-07-27 13:23:55.9315 6] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext Periodic peer flush... starting
[2018-07-27 13:23:56.9740 6] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext Consensus Loop starting
[2018-07-27 13:23:56.9934 1] INFO: Stratis.Bitcoin.Features.MemoryPool.MempoolManager+<LoadPoolAsync>d__25.MoveNext Loading Memory Pool...
[2018-07-27 13:23:56.9934 4] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext MemoryPool.RelayWorker starting
[2018-07-27 13:23:57.0064 4] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext wallet persist job starting
[2018-07-27 13:23:57.0064 1] INFO: Stratis.Bitcoin.Features.Wallet.WalletSyncManager.Start WalletSyncManager initialized. Wallet at block 0.
[2018-07-27 13:23:57.5918 1] INFO: Stratis.Bitcoin.Features.RPC.RPCFeature.Initialize RPC Server listening on:
http://[::1]:11967/
http://127.0.0.1:11967/
[2018-07-27 13:23:57.5994 5] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext DiscoverPeersAsync starting
[2018-07-27 13:23:57.5994 10] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext PeerConnectorAddNode.ConnectAsync starting
[2018-07-27 13:23:57.5994 10] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext PeerConnectorDiscovery.ConnectAsync starting
[2018-07-27 13:23:57.6164 1] INFO: Stratis.Bitcoin.Connection.ConnectionManager.StartNodeServer Node listening on:
0.0.0.0:12655
[2018-07-27 13:23:57.6164 7] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext PeriodicLog starting
[2018-07-27 13:23:57.6461 1] INFO: Stratis.Bitcoin.FullNode.Initialize Full node initialized on RegTest
[2018-07-27 13:23:57.6461 1] INFO: Stratis.Bitcoin.FullNode.Start Starting node...
[2018-07-27 13:23:57.9181 1] INFO: Stratis.Bitcoin.Base.BaseFeature+<StartChainAsync>d__26.MoveNext Loading finalized block height
[2018-07-27 13:23:57.9274 5] INFO: Stratis.Bitcoin.Base.BaseFeature+<StartChainAsync>d__26.MoveNext Loading chain
[2018-07-27 13:23:57.9274 12] INFO: Stratis.Bitcoin.Base.BaseFeature+<StartChainAsync>d__26.MoveNext Chain loaded at height 0
[2018-07-27 13:23:57.9274 5] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext FlushChain starting
[2018-07-27 13:23:57.9274 7] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext Periodic peer flush... starting
[2018-07-27 13:23:58.7767 10] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext Consensus Loop starting
[2018-07-27 13:23:58.7767 1] INFO: Stratis.Bitcoin.Features.MemoryPool.MempoolManager+<LoadPoolAsync>d__25.MoveNext Loading Memory Pool...
[2018-07-27 13:23:58.7767 5] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext MemoryPool.RelayWorker starting
[2018-07-27 13:23:58.7864 13] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext wallet persist job starting
[2018-07-27 13:23:58.7864 1] INFO: Stratis.Bitcoin.Features.Wallet.WalletSyncManager.Start WalletSyncManager initialized. Wallet at block 0.
[2018-07-27 13:23:58.7864 1] INFO: Stratis.Bitcoin.Features.RPC.RPCFeature.Initialize RPC Server listening on:
http://[::1]:12223/
http://127.0.0.1:12223/
[2018-07-27 13:23:58.8024 5] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext DiscoverPeersAsync starting
[2018-07-27 13:23:58.8024 7] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext PeerConnectorAddNode.ConnectAsync starting
[2018-07-27 13:23:58.8024 7] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext PeerConnectorDiscovery.ConnectAsync starting
[2018-07-27 13:23:58.8024 1] INFO: Stratis.Bitcoin.Connection.ConnectionManager.StartNodeServer Node listening on:
0.0.0.0:13329
[2018-07-27 13:23:58.8024 13] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext PeriodicLog starting
[2018-07-27 13:24:01.6791 5] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext WalletManager.DownloadChain starting
[2018-07-27 13:24:02.6318 17] INFO: Stratis.Bitcoin.FullNode.<StartPeriodicLog>b__75_0 ======Node stats====== 07/27/2018 13:24:02 agent node12655-StratisBitcoin:1.1.2
Headers.Height: 0 Headers.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
BlockStore.Height: 0 BlockStore.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Consensus.Height: 0 Consensus.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Wallet.Height: 0 Wallet.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
======BlockStore======
Pending Blocks: 0
Batch Size: 0 kb / 5000 kb
=======Mempool=======
MempoolSize: 0 DynamicSize: 0 kb OrphanSize: 0
======Wallets======
Wallet: mywallet, Confirmed balance: 0.00000000
======Connection======
[2018-07-27 13:24:03.8241 7] INFO: Stratis.Bitcoin.FullNode.<StartPeriodicLog>b__75_0 ======Node stats====== 07/27/2018 13:24:03 agent node13329-StratisBitcoin:1.1.2
Headers.Height: 0 Headers.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
BlockStore.Height: 0 BlockStore.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Consensus.Height: 0 Consensus.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Wallet.Height: No Wallet
======BlockStore======
Pending Blocks: 0
Batch Size: 0 kb / 5000 kb
=======Mempool=======
MempoolSize: 0 DynamicSize: 0 kb OrphanSize: 0
======Connection======
[2018-07-27 13:24:04.1655 5] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext WalletManager.DownloadChain starting
[2018-07-27 13:24:06.6810 6] INFO: Stratis.Bitcoin.Utilities.AsyncLoop+<>c__DisplayClass16_0+<<StartAsync>b__0>d.MoveNext WalletManager.DownloadChain stopping
[2018-07-27 13:24:07.6548 12] INFO: Stratis.Bitcoin.FullNode.<StartPeriodicLog>b__75_0 ======Node stats====== 07/27/2018 13:24:07 agent node12655-StratisBitcoin:1.1.2
Headers.Height: 3 Headers.Hash: 506f45284e3914812bfa4c3023a72926d04fcd0863bdb135d9b86659ab985060
BlockStore.Height: 0 BlockStore.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Consensus.Height: 3 Consensus.Hash: 506f45284e3914812bfa4c3023a72926d04fcd0863bdb135d9b86659ab985060
Wallet.Height: 2 Wallet.Hash: 28d56e9fe90cbb3afbfd1525ddffca084e5f62a3a6dc7a59ca5a79e715eb3b4d
======BlockStore======
Pending Blocks: 2
Batch Size: 0 kb / 5000 kb
=======Mempool=======
MempoolSize: 0 DynamicSize: 0 kb OrphanSize: 0
======Wallets======
Wallet: mywallet, Confirmed balance: 100.00000000
======Connection======
[2018-07-27 13:24:08.8336 12] INFO: Stratis.Bitcoin.FullNode.<StartPeriodicLog>b__75_0 ======Node stats====== 07/27/2018 13:24:08 agent node13329-StratisBitcoin:1.1.2
Headers.Height: 0 Headers.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
BlockStore.Height: 0 BlockStore.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Consensus.Height: 0 Consensus.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Wallet.Height: 0 Wallet.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
======BlockStore======
Pending Blocks: 0
Batch Size: 0 kb / 5000 kb
=======Mempool=======
MempoolSize: 0 DynamicSize: 0 kb OrphanSize: 0
======Wallets======
Wallet: mywallet, Confirmed balance: 0.00000000
======Connection======
[2018-07-27 13:24:23.7374 5] INFO: Stratis.Bitcoin.FullNode.<StartPeriodicLog>b__75_0 ======Node stats====== 07/27/2018 13:24:22 agent node12655-StratisBitcoin:1.1.2
Headers.Height: 3 Headers.Hash: 506f45284e3914812bfa4c3023a72926d04fcd0863bdb135d9b86659ab985060
BlockStore.Height: 3 BlockStore.Hash: 506f45284e3914812bfa4c3023a72926d04fcd0863bdb135d9b86659ab985060
Consensus.Height: 3 Consensus.Hash: 506f45284e3914812bfa4c3023a72926d04fcd0863bdb135d9b86659ab985060
Wallet.Height: 3 Wallet.Hash: 506f45284e3914812bfa4c3023a72926d04fcd0863bdb135d9b86659ab985060
======BlockStore======
Pending Blocks: 0
Batch Size: 0 kb / 5000 kb
=======Mempool=======
MempoolSize: 0 DynamicSize: 0 kb OrphanSize: 0
======Wallets======
Wallet: mywallet, Confirmed balance: 150.00000000
======Connection======
[2018-07-27 13:24:23.7405 13] INFO: Stratis.Bitcoin.FullNode.<StartPeriodicLog>b__75_0 ======Node stats====== 07/27/2018 13:24:22 agent node13329-StratisBitcoin:1.1.2
Headers.Height: 0 Headers.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
BlockStore.Height: 0 BlockStore.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Consensus.Height: 0 Consensus.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Wallet.Height: 0 Wallet.Hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
======BlockStore======
Pending Blocks: 0
Batch Size: 0 kb / 5000 kb
=======Mempool=======
MempoolSize: 0 DynamicSize: 0 kb OrphanSize: 0
======Wallets======
Wallet: mywallet, Confirmed balance: 0.00000000
======Connection======
......@@ -64,6 +64,7 @@ namespace NBitcoin.Networks
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.Coins(9000000000));
genesis.Header.Time = 1493909211;
genesis.Header.Nonce = 2433759;
genesis.Header.Bits = this.Consensus.PowLimit;
......@@ -71,6 +72,8 @@ namespace NBitcoin.Networks
this.Consensus.HashGenesisBlock = genesis.GetHash();
Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"));
//Assert(this.Consensus.HashGenesisBlock == uint256.Parse("5c69790173d48daf2a2a111e0baafb0546ebbec9a831f890ff8c7e23fe119885"));
this.Checkpoints = new Dictionary<int, CheckpointInfo>
{
{ 0, new CheckpointInfo(new uint256("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
......
......@@ -459,7 +459,8 @@ namespace Stratis.Bitcoin.IntegrationTests.Common.EnvironmentMockUpHelpers
var blocks = new List<Block>();
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;
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