Пример #1
0
        public async Task CanCalculateFeeForTx()
        {
            var feePerByte     = 100;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeFacade = new FeeService(feeRateService.Object, 100, 1000);

            var txBuilder = GetTestTx(NBitcoin.Altcoins.BGold.Instance.Testnet);

            await feeFacade.CalcFeeForTransaction(txBuilder.BuildTransaction(true));
        }
        public async Task CanCalculateFeeForTx()
        {
            var feePerByte     = 100;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeFacade = new FeeService(feeRateService.Object, 100, 1000);

            var txBuilder = GetTestTx(Network.RegTest);

            await feeFacade.CalcFeeForTransaction(txBuilder.BuildTransaction(true));
        }
Пример #3
0
        public async Task CanCalculateFeeForTxBuilder()
        {
            PrepareNetworks.EnsureVertcoinPrepared();

            var feePerByte     = 100;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeFacade = new FeeService(feeRateService.Object, 100, 1000);

            var txBuilder = GetTestTx(Network.RegTest);

            await feeFacade.CalcFeeForTransaction(txBuilder);
        }
Пример #4
0
        public async Task ReturnsFeeMaxValueIfCalculatedFeeBiggerThanMaxValue()
        {
            var feePerByte     = 9999;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeMaxValue = 1000;
            var feeFacade   = new FeeService(feeRateService.Object, 100, feeMaxValue);

            var txBuilder = GetTestTx(NBitcoin.Altcoins.BGold.Instance.Testnet);

            var fee = await feeFacade.CalcFeeForTransaction(txBuilder.BuildTransaction(true));

            Assert.True(fee.Satoshi == feeMaxValue);
        }
        public async Task ReturnsFeeMinValueIfCalculatedFeeLessThanMinValue()
        {
            var feePerByte     = 1;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeMaxValue = 1000;
            var feeMinValue = 300;
            var feeFacade   = new FeeService(feeRateService.Object, feeMinValue, feeMaxValue);

            var txBuilder = GetTestTx(Network.RegTest);

            var fee = await feeFacade.CalcFeeForTransaction(txBuilder.BuildTransaction(true));

            Assert.True(fee.Satoshi == feeMinValue);
        }
Пример #6
0
        public async Task ReturnsFeeMaxValueIfCalculatedFeeBiggerThanMaxValue()
        {
            PrepareNetworks.EnsureVertcoinPrepared();

            var feePerByte     = 9999;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeMaxValue = 1000;
            var feeFacade   = new FeeService(feeRateService.Object, 100, feeMaxValue);

            var txBuilder = GetTestTx(Network.RegTest);

            var fee = await feeFacade.CalcFeeForTransaction(txBuilder.BuildTransaction(true));

            Assert.True(fee.Satoshi == feeMaxValue);
        }