public void addPublicKeysSeen(Crypto.Hash transactionHash, Crypto.PublicKey outputKey)
 {
     lock (seen_mutex)
     {
         GlobalMembers.transactions_hash_seen.Add(transactionHash);
     }
     GlobalMembers.public_keys_seen.Add(outputKey);
 }
Beispiel #2
0
        private void loadKeyListAndBalances(CryptoNote.ISerializer serializer, bool saveCache)
        {
            ulong walletCount;

            serializer.functorMethod(walletCount, "walletCount");

            m_actualBalance  = 0;
            m_pendingBalance = 0;
            m_deletedKeys.Clear();

            HashSet <Crypto.PublicKey> cachedKeySet = new HashSet <Crypto.PublicKey>();
            auto index = m_walletsContainer.get <KeysIndex>();

            for (uint i = 0; i < walletCount; ++i)
            {
                Crypto.PublicKey spendPublicKey = new Crypto.PublicKey();
                ulong            actualBalance;
                ulong            pendingBalance;
                serializer.functorMethod(spendPublicKey, "spendPublicKey");

                if (saveCache)
                {
                    serializer.functorMethod(actualBalance, "actualBalance");
                    serializer.functorMethod(pendingBalance, "pendingBalance");
                }

                cachedKeySet.Add(spendPublicKey);

                var it = index.find(spendPublicKey);
                if (it == index.end())
                {
                    m_deletedKeys.emplace(std::move(spendPublicKey));
                }
                else if (saveCache)
                {
                    m_actualBalance  += actualBalance;
                    m_pendingBalance += pendingBalance;

//C++ TO C# CONVERTER TODO TASK: Only lambda expressions having all locals passed by reference can be converted to C#:
//ORIGINAL LINE: index.modify(it, [actualBalance, pendingBalance](WalletRecord& wallet)
                    index.modify(it, (WalletRecord wallet) =>
                    {
                        wallet.actualBalance  = actualBalance;
                        wallet.pendingBalance = pendingBalance;
                    });
                }
            }

            foreach (var wallet in index)
            {
                if (cachedKeySet.count(wallet.spendPublicKey) == 0)
                {
                    m_addedKeys.Add(wallet.spendPublicKey);
                }
            }
        }
Beispiel #3
0
        public override List <Crypto.Hash> getViewKeyKnownBlocks(Crypto.PublicKey publicViewKey)
        {
            var it = m_consumers.find(publicViewKey);

            if (it == m_consumers.end())
            {
                throw new System.ArgumentException("Consumer not found");
            }

//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
            return(m_sync.getConsumerKnownBlocks(it.second));
        }
Beispiel #4
0
 public WalletSerializerV2(ITransfersObserver transfersObserver, Crypto.PublicKey viewPublicKey, Crypto.SecretKey viewSecretKey, ref ulong actualBalance, ref ulong pendingBalance, WalletsContainer walletsContainer, TransfersSyncronizer synchronizer, UnlockTransactionJobs unlockTransactions, boost::multi_index_container <CryptoNote.WalletTransaction, boost::multi_index.indexed_by <boost::multi_index.random_access <boost::multi_index.tag <RandomAccessIndex> >, boost::multi_index.hashed_unique <boost::multi_index.tag <TransactionIndex>, boost::multi_index.member <CryptoNote.WalletTransaction, Crypto.Hash, CryptoNote.WalletTransaction.hash> >, boost::multi_index.ordered_non_unique <boost::multi_index.tag <BlockHeightIndex>, boost::multi_index.member <CryptoNote.WalletTransaction, uint, CryptoNote.WalletTransaction.blockHeight> > > >& transactions, List <Tuple <ulong, CryptoNote.WalletTransfer> > transfers, SortedDictionary <ulong, CryptoNote.Transaction> uncommitedTransactions, string extra, uint transactionSoftLockTime)
 {
     this.m_actualBalance          = actualBalance;
     this.m_pendingBalance         = pendingBalance;
     this.m_walletsContainer       = walletsContainer;
     this.m_synchronizer           = synchronizer;
     this.m_unlockTransactions     = unlockTransactions;
     this.m_transactions           = transactions;
     this.m_transfers              = transfers;
     this.m_uncommitedTransactions = uncommitedTransactions;
     this.m_extra = extra;
 }
Beispiel #5
0
        public void subscribeConsumerNotifications(Crypto.PublicKey viewPublicKey, ITransfersSynchronizerObserver observer)
        {
            var it = m_subscribers.find(viewPublicKey);

//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
            if (it != m_subscribers.end())
            {
//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
                it.second.add(observer);
                return;
            }

            var insertedIt = m_subscribers.Add(viewPublicKey, std::unique_ptr <SubscribersNotifier>(new SubscribersNotifier())).first;

            insertedIt.second.add(observer);
        }
Beispiel #6
0
        public void addPublicKeysSeen(AccountPublicAddress acc, Crypto.Hash transactionHash, Crypto.PublicKey outputKey)
        {
            var it = m_consumers.find(acc.viewPublicKey);

//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
            if (it != m_consumers.end())
            {
//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
                it.second.addPublicKeysSeen(transactionHash, outputKey);
            }
        }
Beispiel #7
0
 public void unsubscribeConsumerNotifications(Crypto.PublicKey viewPublicKey, ITransfersSynchronizerObserver observer)
 {
     m_subscribers[viewPublicKey].remove(observer);
 }
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: virtual PublicKey getTransactionPublicKey() const override
        public override PublicKey GetTransactionPublicKey()
        {
            Crypto.PublicKey pk = new Crypto.PublicKey(GlobalMembers.NULL_PUBLIC_KEY);
            m_extra.getPublicKey(ref pk);
            return(pk);
        }