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)); } } }
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))); } } } }