Пример #1
0
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: const Crypto::Hash& getBlockLongHash() const
        public Crypto.Hash getBlockLongHash()
        {
            if (!blockLongHash.is_initialized())
            {
                if (block.majorVersion == BLOCK_MAJOR_VERSION_1)
                {
                    auto rawHashingBlock = getBlockHashingBinaryArray();
                    blockLongHash = Hash();
                    Crypto.GlobalMembers.cn_slow_hash_v0(rawHashingBlock.data(), rawHashingBlock.size(), blockLongHash.get());
                }
                else if ((block.majorVersion == BLOCK_MAJOR_VERSION_2) || (block.majorVersion == BLOCK_MAJOR_VERSION_3))
                {
                    auto rawHashingBlock = getParentBlockHashingBinaryArray(true);
                    blockLongHash = Hash();
                    Crypto.GlobalMembers.cn_slow_hash_v0(rawHashingBlock.data(), rawHashingBlock.size(), blockLongHash.get());
                }
                else if (block.majorVersion >= BLOCK_MAJOR_VERSION_4)
                {
                    auto rawHashingBlock = getParentBlockHashingBinaryArray(true);
                    blockLongHash = Hash();
                    Crypto.GlobalMembers.cn_lite_slow_hash_v1(rawHashingBlock.data(), rawHashingBlock.size(), blockLongHash.get());
                }
                else
                {
                    throw new System.Exception("Unknown block major version.");
                }
            }

            return(blockLongHash.get());
        }
Пример #2
0
        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");
            }
        }