Exemplo n.º 1
0
        private List <Utxo> GetUnconfirmedUtxo(PaymentAddress address)
        {
            var unconfirmedUtxo = new List <Utxo>();

            using (var addresslist = new PaymentAddressList())
            {
                addresslist.Add(address);
                using (var unconfirmedTxs = chain_.GetMempoolTransactions(addresslist, nodeExecutor_.UseTestnetRules))
                {
                    foreach (var unconfirmedTx in unconfirmedTxs)
                    {
                        unconfirmedUtxo.Add(new Utxo
                        {
                            address       = address.Encoded,
                            txid          = Binary.ByteArrayToHexString(unconfirmedTx.Hash),
                            vout          = 0, //TODO FIX replace with proper tx index
                            amount        = Utils.SatoshisToCoinUnits(unconfirmedTx.TotalOutputValue),
                            satoshis      = (long)unconfirmedTx.TotalOutputValue,
                            height        = -1,
                            confirmations = 0
                        });
                    }
                }
            }

            return(unconfirmedUtxo);
        }
Exemplo n.º 2
0
 public void GetMempoolTransactions()
 {
     using (var addresses = new PaymentAddressList()) {
         addresses.Add(new PaymentAddress("1PDatg81sEwirJU3QUKcGLyfQC6epZNyiL"));
         using (var list = nodeFixture_.Node.Chain.GetMempoolTransactions(addresses, true)) {
             Assert.True(list.Count >= 0);
         }
     }
 }
Exemplo n.º 3
0
 public void GetMempoolTransactions()
 {
     using (var addresses = new PaymentAddressList()) {
         addresses.Add(new PaymentAddress("bchtest:qp7d6x2weeca9fn6eakwvgd9ryq8g6h0tuyks75rt7"));
         using (var list = nodeFixture_.Node.Chain.GetMempoolTransactions(addresses, true))
         {
             Assert.True(list.Count >= 0);
         }
     }
 }
 private void GetUnconfirmedTransactionPositions(PaymentAddress address, SortedSet <Tuple <Int64, string> > txPositions)
 {
     using (var addresslist = new PaymentAddressList())
     {
         addresslist.Add(address);
         using (var unconfirmedTxIds = chain_.GetMempoolTransactions(addresslist, nodeExecutor_.UseTestnetRules))
         {
             foreach (var unconfirmedTxId in unconfirmedTxIds)
             {
                 txPositions.Add(new Tuple <Int64, string>(-1, Binary.ByteArrayToHexString(unconfirmedTxId.Hash)));
             }
         }
     }
 }
Exemplo n.º 5
0
 private async Task <Tuple <ulong, Int64> > GetUnconfirmedSummary(string address)
 {
     using (var paymentAddress = new PaymentAddress(address))
         using (var addresslist = new PaymentAddressList())
         {
             addresslist.Add(paymentAddress);
             using (var unconfirmedTxs = chain_.GetMempoolTransactions(addresslist, nodeExecutor_.UseTestnetRules))
             {
                 Int64 unconfirmedBalance = 0;
                 foreach (var unconfirmedTx in unconfirmedTxs)
                 {
                     using (var getTxResult = await chain_.FetchTransactionAsync(unconfirmedTx.Hash, requireConfirmed: false))
                     {
                         Utils.CheckBitprimApiErrorCode(getTxResult.ErrorCode, "FetchTransactionAsync(" + unconfirmedTx.Hash + ") failed, check error log");
                         ITransaction tx = getTxResult.Result.Tx;
                         unconfirmedBalance += await Utils.CalculateBalanceDelta(tx, address, chain_, nodeExecutor_.UseTestnetRules);
                     }
                 }
                 return(new Tuple <ulong, Int64>(unconfirmedTxs.Count, unconfirmedBalance));
             }
         }
 }