示例#1
0
 public TumblingState(ILoggerFactory loggerFactory,
                      ConcurrentChain chain,
                      WalletManager walletManager,
                      IWatchOnlyWalletManager watchOnlyWalletManager,
                      Network network,
                      WalletTransactionHandler walletTransactionHandler,
                      WalletSyncManager walletSyncManager,
                      IWalletFeePolicy walletFeePolicy,
                      NodeSettings nodeSettings,
                      IBroadcasterManager broadcasterManager,
                      ConnectionManager connectionManager)
 {
     this.Logger                   = loggerFactory.CreateLogger(this.GetType().FullName);
     this.Chain                    = chain;
     this.WalletManager            = walletManager;
     this.WatchOnlyWalletManager   = watchOnlyWalletManager;
     this.CoinType                 = (CoinType)network.Consensus.CoinType;
     this.WalletTransactionHandler = walletTransactionHandler;
     this.WalletSyncManager        = walletSyncManager;
     this.TumblerNetwork           = network;
     this.WalletFeePolicy          = walletFeePolicy;
     this.NodeSettings             = nodeSettings;
     this.BroadcasterManager       = broadcasterManager;
     this.ConnectionManager        = connectionManager;
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WatchOnlyWalletController"/> class.
 /// </summary>
 /// <param name="watchOnlyWalletManager">The watch-only wallet manager.</param>
 public WatchOnlyWalletController(
     ILoggerFactory loggerFactory,
     IWatchOnlyWalletManager watchOnlyWalletManager)
 {
     this.watchOnlyWalletManager = watchOnlyWalletManager;
     this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
 }
        public void Initialize(ILoggerFactory loggerFactory, RegistrationStore registrationStore, bool isBitcoin, Network network, IWatchOnlyWalletManager watchOnlyWalletManager)
        {
            this.loggerFactory          = loggerFactory;
            this.logger                 = loggerFactory.CreateLogger(this.GetType().FullName);
            this.registrationStore      = registrationStore;
            this.network                = network;
            this.watchOnlyWalletManager = watchOnlyWalletManager;

            logger.LogInformation("Initialized RegistrationFeature");
        }
示例#4
0
        public TumbleBitManager(ILoggerFactory loggerFactory, IWalletManager walletManager, IWatchOnlyWalletManager watchOnlyWalletManager, ConcurrentChain chain, Network network, Signals signals)
        {
            this.walletManager          = walletManager;
            this.watchOnlyWalletManager = watchOnlyWalletManager;
            this.chain   = chain;
            this.signals = signals;
            this.network = network;
            this.logger  = loggerFactory.CreateLogger(this.GetType().FullName);

            this.tumblingState = new TumblingState(loggerFactory, this.chain, this.walletManager, this.watchOnlyWalletManager, this.network);
        }
示例#5
0
 public TumblingState(ILoggerFactory loggerFactory,
                      ConcurrentChain chain,
                      IWalletManager walletManager,
                      IWatchOnlyWalletManager watchOnlyWalletManager,
                      Network network)
 {
     this.logger                 = loggerFactory.CreateLogger(this.GetType().FullName);
     this.chain                  = chain;
     this.walletManager          = walletManager;
     this.watchOnlyWalletManager = watchOnlyWalletManager;
     this.coinType               = (CoinType)network.Consensus.CoinType;
 }
#pragma warning restore 649

        /// <inheritdoc />
        public WatchOnlyWalleRPCController(
            IFullNode fullNode,
            IConsensusManager consensusManager,
            ChainIndexer chainIndexer,
            Network network,
            WalletSettings walletSettings,
            IWalletManager walletManager,
            IWatchOnlyWalletManager watchOnlyWalletManager,
            IBlockStore blockStore,
            IChainState chainState) : base(fullNode: fullNode, consensusManager: consensusManager, chainIndexer: chainIndexer, network: network)
        {
            this.fullNode               = fullNode;
            this.chainIndexer           = chainIndexer;
            this.network                = network;
            this.walletSettings         = walletSettings;
            this.walletManager          = walletManager;
            this.watchOnlyWalletManager = watchOnlyWalletManager;
            this.blockStore             = blockStore;
            this.chainState             = chainState;
        }
        public RegistrationFeature(ILoggerFactory loggerFactory,
                                   NodeSettings nodeSettings,
                                   RegistrationManager registrationManager,
                                   RegistrationStore registrationStore,
                                   ConcurrentChain chain,
                                   Signals signals,
                                   IWatchOnlyWalletManager watchOnlyWalletManager,
                                   IBlockNotification blockNotification,
                                   IWalletSyncManager walletSyncManager)
        {
            this.loggerFactory       = loggerFactory;
            this.logger              = loggerFactory.CreateLogger(this.GetType().FullName);
            this.nodeSettings        = nodeSettings;
            this.registrationManager = registrationManager;
            this.registrationStore   = registrationStore;
            this.chain   = chain;
            this.signals = signals;
            this.network = nodeSettings.Network;
            this.watchOnlyWalletManager = watchOnlyWalletManager;
            this.blockNotification      = blockNotification as BlockNotification;
            this.walletSyncManager      = walletSyncManager;

            if (nodeSettings.Network == Network.Main || nodeSettings.Network == Network.TestNet || nodeSettings.Network == Network.RegTest)
            {
                // Bitcoin networks - these currently only interrogate the registration store for initial masternode selection
                this.isBitcoin = true;
            }
            else
            {
                // Stratis networks - these write to the registration store as new registrations come in via blocks
                this.isBitcoin = false;

                // Force registration store to be kept in same folder as other node data
                this.registrationStore.SetStorePath(this.nodeSettings.DataDir);
            }
        }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WatchOnlyWalletController"/> class.
 /// </summary>
 /// <param name="watchOnlyWalletManager">The watch-only wallet manager.</param>
 public WatchOnlyWalletController(IWatchOnlyWalletManager watchOnlyWalletManager)
 {
     this.watchOnlyWalletManager = watchOnlyWalletManager;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WatchOnlyWalletFeature"/> class.
 /// </summary>
 /// <param name="walletManager">The wallet manager.</param>
 /// <param name="signals">The signals.</param>
 public WatchOnlyWalletFeature(IWatchOnlyWalletManager walletManager, Signals.Signals signals)
 {
     this.walletManager = walletManager;
     this.signals       = signals;
 }
示例#10
0
 public BlockObserver(IWatchOnlyWalletManager walletManager)
 {
     this.walletManager = walletManager;
 }
示例#11
0
        public TumbleBitManager(
            ILoggerFactory loggerFactory,
            NodeSettings nodeSettings,
            IWalletManager walletManager,
            IWatchOnlyWalletManager watchOnlyWalletManager,
            ConcurrentChain chain,
            Network network,
            Signals signals,
            IWalletTransactionHandler walletTransactionHandler,
            IWalletSyncManager walletSyncManager,
            IWalletFeePolicy walletFeePolicy,
            IBroadcasterManager broadcasterManager,
            FullNode fullNode,
            ConfigurationOptionWrapper <string>[] configurationOptions)
        {
            this.walletManager            = walletManager as WalletManager;
            this.watchOnlyWalletManager   = watchOnlyWalletManager;
            this.walletSyncManager        = walletSyncManager as WalletSyncManager;
            this.walletTransactionHandler = walletTransactionHandler as WalletTransactionHandler;
            this.chain              = chain;
            this.signals            = signals;
            this.network            = network;
            this.nodeSettings       = nodeSettings;
            this.loggerFactory      = loggerFactory;
            this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
            this.walletFeePolicy    = walletFeePolicy;
            this.broadcasterManager = broadcasterManager;
            this.connectionManager  = fullNode.ConnectionManager as ConnectionManager;
            this.fullNode           = fullNode;

            foreach (var option in configurationOptions)
            {
                if (option.Name.Equals("RegistrationStoreDirectory"))
                {
                    if (option.Value != null)
                    {
                        this.registrationStore = new RegistrationStore(option.Value);
                    }
                    else
                    {
                        this.registrationStore = new RegistrationStore(this.nodeSettings.DataDir);
                    }
                }

                if (option.Name.Equals("MasterNodeUri"))
                {
                    if (option.Value != null)
                    {
                        this.TumblerAddress = option.Value;
                    }
                }
            }

            this.tumblingState = new TumblingState(
                this.loggerFactory,
                this.chain,
                this.walletManager,
                this.watchOnlyWalletManager,
                this.network,
                this.walletTransactionHandler,
                this.walletSyncManager,
                this.walletFeePolicy,
                this.nodeSettings,
                this.broadcasterManager,
                this.connectionManager);

            // Load saved state e.g. previously selected server
            if (File.Exists(this.tumblingState.GetStateFilePath()))
            {
                try
                {
                    this.tumblingState.LoadStateFromMemory();
                }
                catch (NullReferenceException)
                {
                    // The file appears to get corrupted sometimes, not clear why
                    // May be if the node is not shut down correctly
                }
            }

            this.tumblingState.Save();

            // If there was a server address saved, that means we were previously
            // connected to it, and should try to reconnect to it by default when
            // the connect method is invoked by the UI
            if ((this.TumblerAddress == null) && (this.tumblingState.TumblerUri != null))
            {
                this.TumblerAddress = this.tumblingState.TumblerUri.ToString();
            }

            // Remove the progress file from previous session as it is now stale
            ProgressInfo.RemoveProgressFile();
        }
示例#12
0
 public WatchOnlyWalletFeature(IWatchOnlyWalletManager walletManager, Signals signals, ConcurrentChain chain)
 {
     this.walletManager = walletManager;
     this.signals       = signals;
 }
示例#13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WatchOnlyWalletFeature"/> class.
 /// </summary>
 /// <param name="walletManager">The wallet manager.</param>
 /// <param name="signals">The signals.</param>
 public WatchOnlyWalletFeature(IWatchOnlyWalletManager walletManager)
 {
     this.walletManager = walletManager;
 }
示例#14
0
 public TransactionObserver(IWatchOnlyWalletManager walletManager)
 {
     this.walletManager = walletManager;
 }
示例#15
0
        public TumbleBitManager(
            ILoggerFactory loggerFactory,
            NodeSettings nodeSettings,
            IWalletManager walletManager,
            IWatchOnlyWalletManager watchOnlyWalletManager,
            ConcurrentChain chain,
            Network network,
            Signals signals,
            IWalletTransactionHandler walletTransactionHandler,
            IWalletSyncManager walletSyncManager,
            IWalletFeePolicy walletFeePolicy,
            IBroadcasterManager broadcasterManager,
            FullNode fullNode,
            ConfigurationOptionWrapper <string> registrationStoreDirectory)
        {
            this.walletManager            = walletManager as WalletManager;
            this.watchOnlyWalletManager   = watchOnlyWalletManager;
            this.walletSyncManager        = walletSyncManager as WalletSyncManager;
            this.walletTransactionHandler = walletTransactionHandler as WalletTransactionHandler;
            this.chain              = chain;
            this.signals            = signals;
            this.network            = network;
            this.nodeSettings       = nodeSettings;
            this.loggerFactory      = loggerFactory;
            this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
            this.walletFeePolicy    = walletFeePolicy;
            this.broadcasterManager = broadcasterManager;
            this.fullNode           = fullNode;

            if (registrationStoreDirectory.Value != null)
            {
                this.registrationStore = new RegistrationStore(registrationStoreDirectory.Value);
            }
            else
            {
                this.registrationStore = new RegistrationStore(this.nodeSettings.DataDir);
            }

            this.tumblingState = new TumblingState(
                this.loggerFactory,
                this.chain,
                this.walletManager,
                this.watchOnlyWalletManager,
                this.network,
                this.walletTransactionHandler,
                this.walletSyncManager,
                this.walletFeePolicy,
                this.nodeSettings,
                this.broadcasterManager);

            // Load saved state e.g. previously selected server
            if (File.Exists(this.tumblingState.GetStateFilePath()))
            {
                try
                {
                    this.tumblingState.LoadStateFromMemory();
                }
                catch (NullReferenceException)
                {
                    // The file appears to get corrupted sometimes, not clear why
                    // May be if the node is not shut down correctly
                }
            }

            this.tumblingState.Save();

            // Remove the progress file from previous session as it is now stale
            ProgressInfo.RemoveProgressFile();
        }