public RegtestExecutorFixture() { exec_ = new Executor("config/regtest.cfg"); int initChainOk = exec_.InitAndRunAsync().GetAwaiter().GetResult(); if (initChainOk != 0) { throw new InvalidOperationException("Executor::InitAndRunAsync failed, check log"); } //Add mined blocks containing Keoken Transactions using (var sr = new StreamReader("config/blocks.hex")) { while (sr.Peek() >= 0) { string hex = sr.ReadLine(); using (var b = new Block(1, hex)) { ErrorCode errCode = Executor.Chain.OrganizeBlockAsync(b).Result; if (errCode != ErrorCode.Success && errCode != ErrorCode.DuplicateBlock) { throw new Exception("Error loading blocks:" + errCode); } } } } DelegatedState.SetDelegatedState(state_); exec_.KeokenManager.ConfigureState(); exec_.KeokenManager.InitializeFromBlockchain(); }
public void TestGetAssets() { using (var state = new KeokenMemoryState()) { DelegatedState.SetDelegatedState(state); executorFixture_.Executor.KeokenManager.ConfigureState(); executorFixture_.Executor.KeokenManager.InitializeFromBlockchain(); using (var ret = executorFixture_.Executor.KeokenManager.GetAssets()) { Assert.Equal <UInt64>(0, ret.Count); } } }
public void TestGetAssetsByAddress() { using (var state = new KeokenMemoryState()) { DelegatedState.SetDelegatedState(state); executorFixture_.Executor.KeokenManager.ConfigureState(); executorFixture_.Executor.KeokenManager.InitializeFromBlockchain(); using (var address = new PaymentAddress("16TGufqQ9FPnEbixbD4ZjVabaP455roE6t")) { using (var ret = executorFixture_.Executor.KeokenManager.GetAssetsByAddress(address)) { Assert.Equal <UInt64>(0, ret.Count); } } } }
public void TestInitializeFromBlockchain() { using (var state = new KeokenMemoryState()) { DelegatedState.SetDelegatedState(state); executorFixture_.Executor.KeokenManager.ConfigureState(); executorFixture_.Executor.KeokenManager.InitializeFromBlockchain(); Assert.Equal(true, executorFixture_.Executor.KeokenManager.Initialized); } /*using (var delegatedState = new DelegatedState(state)) * { * keokenManager_.ConfigureState(delegatedState); * keokenManager_.InitializeFromBlockchain(); * Assert.Equal(true, keokenManager_.Initialized); * } */ }