Beispiel #1
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");
            }
        }
Beispiel #2
0
        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));
                }
            }
        }