Example #1
0
        public static ExternalServices CreateFromFullNode(IRepository repository, Tracker tracker, TumblingState tumblingState)
        {
            var minimumRate = tumblingState.NodeSettings.MinRelayTxFeeRate;
            var service     = new ExternalServices();

            // On regtest the estimatefee always fails
            if (tumblingState.TumblerNetwork == Network.RegTest)
            {
                service.FeeService = new FullNodeFeeService(tumblingState.WalletFeePolicy)
                {
                    MinimumFeeRate  = minimumRate,
                    FallBackFeeRate = new FeeRate(Money.Satoshis(50), 1)
                };
            }
            else // On test and mainnet fee estimation should just fail, not fall back to fixed fee
            {
                service.FeeService = new FullNodeFeeService(tumblingState.WalletFeePolicy)
                {
                    MinimumFeeRate = minimumRate
                };
            }

            var cache = new FullNodeWalletCache(tumblingState);

            service.WalletService           = new FullNodeWalletService(tumblingState);
            service.BroadcastService        = new FullNodeBroadcastService(cache, repository, tumblingState);
            service.BlockExplorerService    = new FullNodeBlockExplorerService(cache, tumblingState);
            service.TrustedBroadcastService = new FullNodeTrustedBroadcastService(service.BroadcastService, service.BlockExplorerService, repository, cache, tracker, tumblingState)
            {
                // BlockExplorer will already track the addresses, since they used a shared bitcoind, no need of tracking again (this would overwrite labels)
                TrackPreviousScriptPubKey = false
            };
            return(service);
        }
Example #2
0
        public static ExternalServices CreateUsingFullNode(IRepository repository, Tracker tracker, TumblingState tumblingState)
        {
            FeeRate minimumRate = new FeeRate(MempoolValidator.MinRelayTxFee.FeePerK);

            ExternalServices service = new ExternalServices();

            service.FeeService = new FullNodeFeeService()
            {
                MinimumFeeRate = minimumRate
            };

            // on regtest the estimatefee always fails
            if (tumblingState.TumblerNetwork == Network.RegTest)
            {
                service.FeeService = new FullNodeFeeService()
                {
                    MinimumFeeRate  = minimumRate,
                    FallBackFeeRate = new FeeRate(Money.Satoshis(50), 1)
                };
            }

            // TODO: These ultimately need to be brought in from the tumblebit client UI
            string dummyWalletName  = "";
            string dummyAccountName = "";

            FullNodeWalletCache cache = new FullNodeWalletCache(repository, tumblingState);

            service.WalletService           = new FullNodeWalletService(tumblingState, dummyWalletName, dummyAccountName);
            service.BroadcastService        = new FullNodeBroadcastService(cache, repository, tumblingState);
            service.BlockExplorerService    = new FullNodeBlockExplorerService(cache, repository, tumblingState);
            service.TrustedBroadcastService = new FullNodeTrustedBroadcastService(service.BroadcastService, service.BlockExplorerService, repository, cache, tracker, tumblingState)
            {
                // BlockExplorer will already track the addresses, since they used a shared bitcoind, no need of tracking again (this would overwrite labels)
                TrackPreviousScriptPubKey = false
            };
            return(service);
        }