* Fix * -print * Filter null outputs * Rewards cc * Fix * Linker * Fix * Fix * KOMODO_LONGESTCHAIN * Mining_height * Fix dropped assetoshis * Error null CCvin * Test * Test * Test * Fix sell * Fix order book prints * ) * Test * Test * Fix order display * Fix oops * Fix duplicate vin * Remove dust check * Fix silly bug * Test * Test * Fix * Test * Test * Test * Test * Test * Test * Test * Fix compiler error: call of overloaded 'Pair(const char [9], time_t)' is ambiguous * Fix compiler error: call of overloaded 'Pair(const char [9], time_t)' is ambiguous * Correctly parse optional top parameter to getsnapshot * Fix token orders crash * Add SEC to assetchains.json * Split amounts/validation: bid, ask, swap * Fixes * Test * Test * Test * Test * +print * Test * Test * Test * Test * Test * Test * SMALLVAL * Test * Test * Test * Test * Test * Test * Test * Properly handle multiple vins funding fills * Test * Test * Test * Test * Fix ask fill dest * Test * Rewards functions * Fix * Test * Params to rewardscalc * Create funding, addfunding, lock * Test * +print * tokenswapask * Test * Test * Swap functions * ac_cc under 1000 is not fungible * Allow to cancel invalid orders * Prevent negative numbers in assets tx * Uint64 -> int64 * Fix oops * Prevent bid for nonexistent assetid * Error check bidding for assetid that is txid but not asset creation * Fix * Fix * Add pause if scriptcheckqueue isn't idle * Fix * -> -> . * Fix * Test * VOBJ * Tokeninfo rpc * Asset list * Test * strcpy(cp->normaladdr,AssetsNormaladdr); * Fix * Rewardslist rewardsinfo * Fix * Fix * Fix * Vent * fix * Int64 * Int64 * Fix createfunding * Fix false positive error * sbits = stringbits(planstr); * Fix maxmoney * Fix funding name * Test * Print * CCutoxvalue * Fix rewardslock utxo selection * New PoW diff calc * tst * Test * Oldflag for PoW calc * Test * Test * tst * Test * Test * Filter locked utxo * Test * Fix PoW recalc * Test min seconds * int64_t CCduration(uint256 txid) * Test * Test * Test one day * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Prevent inputs of CC inputs * Test * tst * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * New rewards address * Fix mask * Test * Test * Test * Test * Test * Test * Teest * Stricter vin/vout checks for assets * Token swap ready for testing * Fix rewards unlock * Fix * Test * Validate rewards * Test * Trim funding input * Test * Test * Test * Test * Test * Test * Test * Test * Test * Activate CCduration constraint * Parameterize KOMODO_FIRSTFUNGIBLEID to 100 * +print * Test * Test * Test * Test * Fix c script * Test * Initial dice morph from rewards.cpp * Fix * Test * Fix * Test * Diceaddfunds * Fix * Dice list and dice info * dicefund * Dice bet * Test * Test * Put process block's check block call inside lock, revert mining testblockvalidity outside lock * Don't exit fiat-cli on error * Docs for coinsupply RPC and improved error-checking on block height * Version to 0.3.12-beta. * Change version to 0.3.12 for gilab CI. * Put undefines for _cpuid back. * Network decentralizatoin and bug fixes * Remove unnecessary staking delay * Staking and mining timeing improvements * Put staking readout once per staking loop so people know it's staking * Fail on get_chainactive before lock if checks fail * Fix check for stake transaction after Komodo merge * Portable dev (#105) * Force portable code * Switch to old MMX instructions, avoiding SSE & SSE2 instructions. * Less agressive, leave verus code (which checks for it) using advanced instructions. * Compiling only for windows * Update .gitlab-ci.yml * Try -march=native for C++ code generation. * Tweaking machine architecture settings. * Try native alone. * Also get LIBCRYPTOCONDITIONS to -march=native * Switch other lib to native as well. * Try switching back further for CPU architecture. * Even lower end settings. * Turn on symbols. * Use sse2,3 and 4 capable x64. * Once again let verus lib use advances instructioins since it checjs via CPUID at run time. * Modify a few more makefile entries. * Switch to AMD model similar to our test system. * Get snark makefile to k8 too. * Yet another -march to modify to k8, or two of them. * Brute force k8 settings, comment non-portable code out. * Put the condition on cpuid back. * Put non-portable advenced instruction code back * Enable instructions. * Add lib for separate settings. * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * replacing k8-sse3 specific flags to x86-84 * updating versions * updating versions * Get verus-cli verusd updated (#106) * Force portable code * Switch to old MMX instructions, avoiding SSE & SSE2 instructions. * Less agressive, leave verus code (which checks for it) using advanced instructions. * Compiling only for windows * Update .gitlab-ci.yml * Try -march=native for C++ code generation. * Tweaking machine architecture settings. * Try native alone. * Also get LIBCRYPTOCONDITIONS to -march=native * Switch other lib to native as well. * Try switching back further for CPU architecture. * Even lower end settings. * Turn on symbols. * Use sse2,3 and 4 capable x64. * Once again let verus lib use advances instructioins since it checjs via CPUID at run time. * Modify a few more makefile entries. * Switch to AMD model similar to our test system. * Get snark makefile to k8 too. * Yet another -march to modify to k8, or two of them. * Brute force k8 settings, comment non-portable code out. * Put the condition on cpuid back. * Put non-portable advenced instruction code back * Enable instructions. * Add lib for separate settings. * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * replacing k8-sse3 specific flags to x86-84 * updating versions * Propagate verusd changes.
102 lines
4.2 KiB
C++
102 lines
4.2 KiB
C++
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_TXDB_H
|
|
#define BITCOIN_TXDB_H
|
|
|
|
#include "coins.h"
|
|
#include "leveldbwrapper.h"
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
#include <univalue.h>
|
|
|
|
class CBlockFileInfo;
|
|
class CBlockIndex;
|
|
struct CDiskTxPos;
|
|
struct CAddressUnspentKey;
|
|
struct CAddressUnspentValue;
|
|
struct CAddressIndexKey;
|
|
struct CAddressIndexIteratorKey;
|
|
struct CAddressIndexIteratorHeightKey;
|
|
struct CTimestampIndexKey;
|
|
struct CTimestampIndexIteratorKey;
|
|
struct CTimestampBlockIndexKey;
|
|
struct CTimestampBlockIndexValue;
|
|
struct CSpentIndexKey;
|
|
struct CSpentIndexValue;
|
|
class uint256;
|
|
|
|
//! -dbcache default (MiB)
|
|
static const int64_t nDefaultDbCache = 450;
|
|
//! max. -dbcache (MiB)
|
|
static const int64_t nMaxDbCache = sizeof(void*) > 4 ? 16384 : 1024;
|
|
//! min. -dbcache in (MiB)
|
|
static const int64_t nMinDbCache = 4;
|
|
|
|
/** CCoinsView backed by the LevelDB coin database (chainstate/) */
|
|
class CCoinsViewDB : public CCoinsView
|
|
{
|
|
protected:
|
|
CLevelDBWrapper db;
|
|
CCoinsViewDB(std::string dbName, size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
|
public:
|
|
CCoinsViewDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
|
|
|
bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const;
|
|
bool GetNullifier(const uint256 &nf) const;
|
|
bool GetCoins(const uint256 &txid, CCoins &coins) const;
|
|
bool HaveCoins(const uint256 &txid) const;
|
|
uint256 GetBestBlock() const;
|
|
uint256 GetBestAnchor() const;
|
|
bool BatchWrite(CCoinsMap &mapCoins,
|
|
const uint256 &hashBlock,
|
|
const uint256 &hashAnchor,
|
|
CAnchorsMap &mapAnchors,
|
|
CNullifiersMap &mapNullifiers);
|
|
bool GetStats(CCoinsStats &stats) const;
|
|
};
|
|
|
|
/** Access to the block database (blocks/index/) */
|
|
class CBlockTreeDB : public CLevelDBWrapper
|
|
{
|
|
public:
|
|
CBlockTreeDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false, bool compression = true, int maxOpenFiles = 1000);
|
|
private:
|
|
CBlockTreeDB(const CBlockTreeDB&);
|
|
void operator=(const CBlockTreeDB&);
|
|
public:
|
|
bool WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo);
|
|
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &fileinfo);
|
|
bool ReadLastBlockFile(int &nFile);
|
|
bool WriteReindexing(bool fReindex);
|
|
bool ReadReindexing(bool &fReindex);
|
|
bool ReadTxIndex(const uint256 &txid, CDiskTxPos &pos);
|
|
bool WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos> > &list);
|
|
bool ReadSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value);
|
|
bool UpdateSpentIndex(const std::vector<std::pair<CSpentIndexKey, CSpentIndexValue> >&vect);
|
|
bool UpdateAddressUnspentIndex(const std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue > >&vect);
|
|
bool ReadAddressUnspentIndex(uint160 addressHash, int type,
|
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &vect);
|
|
bool WriteAddressIndex(const std::vector<std::pair<CAddressIndexKey, CAmount> > &vect);
|
|
bool EraseAddressIndex(const std::vector<std::pair<CAddressIndexKey, CAmount> > &vect);
|
|
bool ReadAddressIndex(uint160 addressHash, int type,
|
|
std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,
|
|
int start = 0, int end = 0);
|
|
bool WriteTimestampIndex(const CTimestampIndexKey ×tampIndex);
|
|
bool ReadTimestampIndex(const unsigned int &high, const unsigned int &low, const bool fActiveOnly, std::vector<std::pair<uint256, unsigned int> > &vect);
|
|
bool WriteTimestampBlockIndex(const CTimestampBlockIndexKey &blockhashIndex, const CTimestampBlockIndexValue &logicalts);
|
|
bool ReadTimestampBlockIndex(const uint256 &hash, unsigned int &logicalTS);
|
|
bool WriteFlag(const std::string &name, bool fValue);
|
|
bool ReadFlag(const std::string &name, bool &fValue);
|
|
bool LoadBlockIndexGuts();
|
|
bool blockOnchainActive(const uint256 &hash);
|
|
UniValue Snapshot(int top);
|
|
};
|
|
|
|
#endif // BITCOIN_TXDB_H
|