public void Init() { _transactionVerifier = Services.GetService <ITransactionVerifier>(); _difficultyService = Services.GetService <IDifficultyService>(); _blockChainService = Services.GetService <IBlockChainService>(); _minerService = Services.GetService <IMinerService>(); }
public void Init() { _blockChainService = Services.GetService <IBlockChainService>(); _difficultyService = Services.GetService <IDifficultyService>(); _transactionVerifier = Services.GetService <ITransactionVerifier>(); _walletService = Services.GetService <IWalletService>(); _logger = Services.GetService <ILogger>(); _eventManager = Services.GetService <IEventManager>(); _memPoolFullPath = $"{Configurations.CurrentPath}\\BlockChain\\Data\\MemPool.json"; TryLoadMemPool(); MemPool.CollectionChanged += MemPool_CollectionChanged; CurrentWorkers = new List <Thread>(); Terminators = new Dictionary <int, bool>(); return; Task.Run(delegate { _logger.Log("Starting first miner in 6.."); Thread.Sleep(3000); _logger.Log("Starting first miner in 3.."); Thread.Sleep(3000); TryRestartingWorkers(); }); }
public RefundClaimant(IRefundService refundService, IBlockchainBridge blockchainBridge, IDepositDetailsRepository depositRepository, ITransactionVerifier transactionVerifier, ILogManager logManager) { _refundService = refundService; _blockchainBridge = blockchainBridge; _depositRepository = depositRepository; _transactionVerifier = transactionVerifier; _logger = logManager.GetClassLogger(); }
private void SetUpSubstitutes() { transactionVerifier = Substitute.For <ITransactionVerifier>(); paymentClaimProcessor = Substitute.For <IPaymentClaimProcessor>(); depositManager = Substitute.For <IDepositManager>(); providerDepositApprovalRepository = Substitute.For <IProviderDepositApprovalRepository>(); gasPriceService = Substitute.For <IGasPriceService>(); wallet = NullWallet.Instance; blockchainBridge = Substitute.For <INdmBlockchainBridge>(); refundPolicy = Substitute.For <IRefundPolicy>(); }
public void Init() { Logger = Services.GetService <ILogger>(); _transactionVerifier = Services.GetService <ITransactionVerifier>(); _provider = new RSACryptoServiceProvider(2048); KeysFolderPath = $"{Configurations.CurrentPath}\\Keys"; PubKeysPath = $"{KeysFolderPath}\\pub.key"; PrivKeysPath = $"{KeysFolderPath}\\priv.key"; TryGenerateingNewkeys(); }
public void Setup() { Prepare(); _claimedRefundTransactionHash = TestItem.KeccakA; _refundService = Substitute.For <IRefundService>(); _refundService.ClaimRefund(Arg.Any <Address>(), Arg.Any <RefundClaim>()) .Returns(_claimedRefundTransactionHash); _refundService.ClaimEarlyRefund(Arg.Any <Address>(), Arg.Any <EarlyRefundClaim>()) .Returns(_claimedRefundTransactionHash); _depositRepository = Substitute.For <IDepositDetailsRepository>(); _transactionVerifier = Substitute.For <ITransactionVerifier>(); _transactionVerifier.Verify(Arg.Any <TxReceipt>()).Returns(new TransactionVerifierResult(true, 1, 1)); _refundClaimant = new RefundClaimant(_refundService, _bridge, _depositRepository, _transactionVerifier, LimboLogs.Instance); }
public Node(ITransactionVerifier transactionVerifier, string overrideFilelocation = "", bool overideBlockchainSave = false, IPAddress master = null, IDotcoinServer dotcoinServer = null) { //if you dont pass in a master address it assumes //there is no master and takes over that roll IPAddress myIp = null; var hostname = Dns.GetHostName(); Console.WriteLine(string.Format("Nodes hostname is: {0}", hostname)); var ips = Dns.GetHostAddresses(hostname); foreach (var ip in ips) { //TODO make this a correct public ip myIp = ip; _masterAddress = ip; Console.WriteLine(ip.ToString()); } if (myIp == null) { throw new Exception("Error getting ip"); } if (master == null) { _masterAddress = myIp; } if (dotcoinServer == null) //default server for the chain { dotcoinServer = new DotcoinTCPServer(); } _network = new DotcoinNetwork(myIp, _masterAddress, dotcoinServer); _transactionVerifier = transactionVerifier; _overideBlockchainSave = overideBlockchainSave; if (overrideFilelocation == "") { overrideFilelocation = "dotcoin.chain"; } _blockChain = new BlockChain(overrideFilelocation); }
public TransactionManager( ITransactionVerifier transactionVerifier, IContractRegisterer contractRegisterer, IStateManager stateManager ) { _stateManager = stateManager ?? throw new ArgumentNullException(nameof(stateManager)); _transactionVerifier = transactionVerifier ?? throw new ArgumentNullException(nameof(transactionVerifier)); _transactionExecuter = new TransactionExecuter(contractRegisterer); _transactionExecuter.OnSystemContractInvoked += (sender, context) => OnSystemContractInvoked?.Invoke(sender, context); // once a transaction is verified asynchronously, it invokes OnTransacionVerified // and this adds the transaction to _verifiedTransactions transactionVerifier.OnTransactionVerified += (sender, transaction) => _verifiedTransactions.TryAdd(transaction.Hash, transaction.Hash); }
public void Setup() { Prepare(); _claimedRefundTransactionHash = TestItem.KeccakA; _refundService = Substitute.For <IRefundService>(); _refundService.ClaimRefundAsync(Arg.Any <Address>(), Arg.Any <RefundClaim>(), Arg.Any <UInt256>()) .Returns(_claimedRefundTransactionHash); _refundService.ClaimEarlyRefundAsync(Arg.Any <Address>(), Arg.Any <EarlyRefundClaim>(), Arg.Any <UInt256>()) .Returns(_claimedRefundTransactionHash); _depositRepository = Substitute.For <IDepositDetailsRepository>(); _transactionVerifier = Substitute.For <ITransactionVerifier>(); _transactionVerifier.VerifyAsync(Arg.Any <NdmTransaction>()) .Returns(new TransactionVerifierResult(true, 1, 1)); _gasPriceService = Substitute.For <IGasPriceService>(); _timestamper = Timestamper.Default; _refundClaimant = new RefundClaimant(_refundService, _ndmBridge, _depositRepository, _transactionVerifier, _gasPriceService, _timestamper, LimboLogs.Instance); }
public void Init() { _blockChainPath = Configurations.CurrentPath + "\\BlockChain\\"; _blockChainFullPath = $"{_blockChainPath}\\Chain\\"; _blockInfoDbFullPath = _blockChainPath + "\\Data\\BlockInfo.sqlite"; _logger = Services.GetService <ILogger>(); _transactionVerifier = Services.GetService <ITransactionVerifier>(); _blockVerifier = Services.GetService <IBlockVerifier>(); _server = Services.GetService <IP2PServer>(); _eventManager = Services.GetService <IEventManager>(); _eventManager.RegisterEventListener(OnNewBlock, EventTypes.EventType.NewBlock); _mappingService = Services.GetService <IMappingService>(); _minerService = Services.GetService <IMinerService>(); _walletService = Services.GetService <IWalletService>(); TryConnectToBlockInfoDb(); TryLoadSavedInfo(); _askedForRequests = new List <InvitationRequest>(); }
public TransactionPool( ITransactionVerifier transactionVerifier, IPoolRepository poolRepository, ITransactionManager transactionManager, IBlockManager blockManager, INonceCalculator nonceCalculator, IStateManager stateManager, ITransactionHashTrackerByNonce transactionHashTracker ) { _transactionVerifier = transactionVerifier; _poolRepository = poolRepository; _transactionManager = transactionManager; _blockManager = blockManager; _nonceCalculator = nonceCalculator; _stateManager = stateManager; _transactionHashTracker = transactionHashTracker; _transactionsQueue = new HashSet <TransactionReceipt>(); _blockManager.OnBlockPersisted += OnBlockPersisted; }
public void Setup() { _blockchainBridge = Substitute.For <INdmBlockchainBridge>(); _requiredBlockConfirmations = 2; _transactionVerifier = new TransactionVerifier(_blockchainBridge, _requiredBlockConfirmations); }
/// <summary> /// Initializes a new instance of <see cref="BlockVerifier"/> using the given parameters. /// </summary> /// <param name="blockchain">Blockchain data base</param> /// <param name="txVerifier">Transaction verifier</param> /// <param name="consensus">Consensus rules</param> public BlockVerifier(IBlockchain blockchain, ITransactionVerifier txVerifier, IConsensus consensus) { chain = blockchain; txVer = txVerifier; this.consensus = consensus; }
/// <summary> /// Initializes a new instance of <see cref="BlockVerifier"/> using the given parameters. /// </summary> /// <param name="txVerifier">Transaction verifier</param> /// <param name="consensus">Consensus rules</param> public BlockVerifier(ITransactionVerifier txVerifier, IConsensus consensus) { txVer = txVerifier; this.consensus = consensus; }
public WebServiceController() { _transactionVerifier = Services.GetService <ITransactionVerifier>(); _eventManager = Services.GetService <IEventManager>(); _blockChainService = Services.GetService <IBlockChainService>(); }