private void saveUnlockTransactionsJobs(CryptoNote.ISerializer serializer) { auto index = m_unlockTransactions.get <TransactionHashIndex>(); auto wallets = m_walletsContainer.get <TransfersContainerIndex>(); ulong jobsCount = index.size(); serializer.functorMethod(jobsCount, "unlockTransactionsJobsCount"); foreach (var j in index) { var containerIt = wallets.find(j.container); Debug.Assert(containerIt != wallets.end()); var keyIt = m_walletsContainer.project <KeysIndex>(containerIt); Debug.Assert(keyIt != m_walletsContainer.get <KeysIndex>().end()); UnlockTransactionJobDtoV2 dto = new UnlockTransactionJobDtoV2(); dto.blockHeight = j.blockHeight; dto.transactionHash = j.transactionHash; dto.walletSpendPublicKey = keyIt.spendPublicKey; serializer.functorMethod(dto, "unlockTransactionsJob"); } }
private void loadUnlockTransactionsJobs(CryptoNote.ISerializer serializer) { auto index = m_unlockTransactions.get <TransactionHashIndex>(); auto walletsIndex = m_walletsContainer.get <KeysIndex>(); ulong jobsCount = 0; serializer.functorMethod(jobsCount, "unlockTransactionsJobsCount"); for (ulong i = 0; i < jobsCount; ++i) { UnlockTransactionJobDtoV2 dto = new UnlockTransactionJobDtoV2(); serializer.functorMethod(dto, "unlockTransactionsJob"); var walletIt = walletsIndex.find(dto.walletSpendPublicKey); if (walletIt != walletsIndex.end()) { UnlockTransactionJob job = new UnlockTransactionJob(); job.blockHeight = dto.blockHeight; job.transactionHash = dto.transactionHash; job.container = walletIt.container; index.insert(std::move(job)); } } }
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); } } }
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: const BinaryArray& getBlockHashingBinaryArray() const public BinaryArray getBlockHashingBinaryArray() { if (!blockHashingBinaryArray.is_initialized()) { blockHashingBinaryArray = BinaryArray(); auto result = blockHashingBinaryArray.get(); if (!CryptoNote.GlobalMembers.toBinaryArray((BlockHeader)block, ref result)) { blockHashingBinaryArray.reset(); throw new System.Exception("Can't serialize BlockHeader"); } auto treeHash = getTransactionTreeHash(); result.insert(result.end(), treeHash.data, treeHash.data + 32); var transactionCount = Common.asBinaryArray(Tools.get_varint_data(block.transactionHashes.size() + 1)); result.insert(result.end(), transactionCount.begin(), transactionCount.end()); } return(blockHashingBinaryArray.get()); }
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: const Crypto::Hash& getBlockHash() const public Crypto.Hash getBlockHash() { if (!blockHash.is_initialized()) { BinaryArray blockBinaryArray = getBlockHashingBinaryArray(); if (BLOCK_MAJOR_VERSION_2 <= block.majorVersion) { auto parentBlock = getParentBlockHashingBinaryArray(false); blockBinaryArray.insert(blockBinaryArray.end(), parentBlock.begin(), parentBlock.end()); } blockHash = CryptoNote.GlobalMembers.getObjectHash(blockBinaryArray); } return(blockHash.get()); }