Example #1
0
        public void GetNewAddress_WithIncompatibleAddressType_ThrowsException()
        {
            RPCServerException exception = Assert.Throws <RPCServerException>(() =>
            {
                NewAddressModel result = this.controller.GetNewAddress("", "x");
            });

            Assert.NotNull(exception);
            Assert.Equal("Only address type 'legacy' is currently supported.", exception.Message);
        }
Example #2
0
        public void GetNewAddress_WithAccountParameterSet_ThrowsException()
        {
            RPCServerException exception = Assert.Throws <RPCServerException>(() =>
            {
                NewAddressModel result = this.controller.GetNewAddress("test");
            });

            Assert.NotNull(exception);
            Assert.Equal("Use of 'account' parameter has been deprecated", exception.Message);
        }
Example #3
0
        public async Task GetRawTransactionAsync_PooledTransactionAndBlockStoreServiceNotAvailable_ReturnsNullAsync()
        {
            var txId = new uint256(12142124);

            this.blockStore.Setup(f => f.GetTransactionById(txId))
            .Returns((Transaction)null)
            .Verifiable();

            this.controller = new FullNodeController(this.LoggerFactory.Object, null, this.pooledGetUnspentTransaction.Object, this.getUnspentTransaction.Object, this.networkDifficulty.Object,
                                                     this.fullNode.Object, this.nodeSettings, this.network, this.chain, this.chainState.Object, this.connectionManager.Object, this.consensusManager.Object, this.blockStore.Object);

            RPCServerException exception = await Assert.ThrowsAsync <RPCServerException>(async() =>
            {
                TransactionModel result = await this.controller.GetRawTransactionAsync(txId.ToString(), false).ConfigureAwait(false);
            });

            Assert.NotNull(exception);
            Assert.Equal("No such mempool transaction. Use -txindex to enable blockchain transaction queries.", exception.Message);
            this.blockStore.Verify();
        }
Example #4
0
        public async Task GetRawTransactionAsync_TransactionCannotBeFound_ThrowsExceptionAsync()
        {
            var txId = new uint256(12142124);

            this.pooledTransaction.Setup(p => p.GetTransaction(txId))
            .ReturnsAsync((Transaction)null)
            .Verifiable();

            this.blockStore.Setup(b => b.GetTransactionById(txId))
            .Returns((Transaction)null)
            .Verifiable();

            RPCServerException exception = await Assert.ThrowsAsync <RPCServerException>(async() =>
            {
                TransactionModel result = await this.controller.GetRawTransactionAsync(txId.ToString(), false).ConfigureAwait(false);
            });

            Assert.NotNull(exception);
            Assert.Equal("No such mempool transaction. Use -txindex to enable blockchain transaction queries.", exception.Message);
            this.blockStore.Verify();

            this.pooledTransaction.Verify();
            this.blockStore.Verify();
        }