Raven Core
3.0.0
P2P Digital Currency
|
#include <assets.h>
Public Member Functions | |
CAssetsCache () | |
CAssetsCache (const CAssetsCache &cache) | |
CAssetsCache & | operator= (const CAssetsCache &cache) |
bool | RemoveNewAsset (const CNewAsset &asset, const std::string address) |
Cache only undo functions. More... | |
bool | RemoveTransfer (const CAssetTransfer &transfer, const std::string &address, const COutPoint &out) |
Changes Memory Only. More... | |
bool | RemoveOwnerAsset (const std::string &assetsName, const std::string address) |
Changes Memory Only. More... | |
bool | RemoveReissueAsset (const CReissueAsset &reissue, const std::string address, const COutPoint &out, const std::vector< std::pair< std::string, CBlockAssetUndo > > &vUndoIPFS) |
Changes Memory Only. More... | |
bool | UndoAssetCoin (const Coin &coin, const COutPoint &out) |
bool | RemoveQualifierAddress (const std::string &assetName, const std::string &address, const QualifierType type) |
Changes Memory Only, this is only called when undoing a block from the chain. More... | |
bool | RemoveRestrictedAddress (const std::string &assetName, const std::string &address, const RestrictedType type) |
Changes Memory Only, this is only called when undoing a block from the chain. More... | |
bool | RemoveGlobalRestricted (const std::string &assetName, const RestrictedType type) |
Changes Memory Only, this is only called when undoing a block from the chain. More... | |
bool | RemoveRestrictedVerifier (const std::string &assetName, const std::string &verifier, const bool fUndoingReissue=false) |
Changes Memory Only. More... | |
bool | AddNewAsset (const CNewAsset &asset, const std::string address, const int &nHeight, const uint256 &blockHash) |
Cache only add asset functions. More... | |
bool | AddTransferAsset (const CAssetTransfer &transferAsset, const std::string &address, const COutPoint &out, const CTxOut &txOut) |
bool | AddOwnerAsset (const std::string &assetsName, const std::string address) |
Changes Memory Only. More... | |
bool | AddReissueAsset (const CReissueAsset &reissue, const std::string address, const COutPoint &out) |
Changes Memory Only. More... | |
bool | AddQualifierAddress (const std::string &assetName, const std::string &address, const QualifierType type) |
Changes Memory Only, this only called when adding a block to the chain. More... | |
bool | AddRestrictedAddress (const std::string &assetName, const std::string &address, const RestrictedType type) |
Changes Memory Only, this only called when adding a block to the chain. More... | |
bool | AddGlobalRestricted (const std::string &assetName, const RestrictedType type) |
Changes Memory Only, this only called when adding a block to the chain. More... | |
bool | AddRestrictedVerifier (const std::string &assetName, const std::string &verifier) |
Changes Memory Only. More... | |
bool | TrySpendCoin (const COutPoint &out, const CTxOut &coin) |
Cache only validation functions. More... | |
bool | ContainsAsset (const CNewAsset &asset) |
Help functions. More... | |
bool | ContainsAsset (const std::string &assetName) |
bool | CheckIfAssetExists (const std::string &name, bool fForceDuplicateCheck=true) |
Returns true if an asset with this name already exists. More... | |
bool | GetAssetMetaDataIfExists (const std::string &name, CNewAsset &asset) |
Returns true if an asset with the name exists, and it was able to get the asset metadata from database. More... | |
bool | GetAssetMetaDataIfExists (const std::string &name, CNewAsset &asset, int &nHeight, uint256 &blockHash) |
bool | GetAssetVerifierStringIfExists (const std::string &name, CNullAssetTxVerifierString &verifier, bool fSkipTempCache=false) |
Returns true if the Asset Verifier String was found for an asset_name, if fSkipTempCache is true, it will only search passets pointer and databases. More... | |
bool | CheckForAddressQualifier (const std::string &qualifier_name, const std::string &address, bool fSkipTempCache=false) |
Return true if the address has the given qualifier assigned to it. More... | |
bool | CheckForAddressRestriction (const std::string &restricted_name, const std::string &address, bool fSkipTempCache=false) |
Return true if the address is marked as frozen. More... | |
bool | CheckForGlobalRestriction (const std::string &restricted_name, bool fSkipTempCache=false) |
Return true if the restricted asset is globally freezing trading. More... | |
size_t | DynamicMemoryUsage () const |
Calculate the size of the CAssets (in bytes) More... | |
size_t | GetCacheSize () const |
Get the size of the none databased cache. More... | |
size_t | GetCacheSizeV2 () const |
Get an estimated size of the cache in bytes that will be needed inorder to save to database. More... | |
bool | Flush () |
Flush all new cache entries into the passets global cache. More... | |
bool | DumpCacheToDatabase () |
Write asset cache data to database. More... | |
void | ClearDirtyCache () |
Clear all dirty cache sets, vetors, and maps. More... | |
std::string | CacheToString () const |
Public Member Functions inherited from CAssets | |
CAssets (const CAssets &assets) | |
CAssets & | operator= (const CAssets &other) |
CAssets () | |
void | SetNull () |
Private Member Functions | |
bool | AddBackSpentAsset (const Coin &coin, const std::string &assetName, const std::string &address, const CAmount &nAmount, const COutPoint &out) |
Changes Memory Only. More... | |
void | AddToAssetBalance (const std::string &strName, const std::string &address, const CAmount &nAmount) |
bool | UndoTransfer (const CAssetTransfer &transfer, const std::string &address, const COutPoint &outToRemove) |
Changes Memory Only. More... | |
|
inline |
|
inline |
|
private |
Changes Memory Only.
Definition at line 1769 of file assets.cpp.
bool CAssetsCache::AddGlobalRestricted | ( | const std::string & | assetName, |
const RestrictedType | type | ||
) |
Changes Memory Only, this only called when adding a block to the chain.
Definition at line 2138 of file assets.cpp.
bool CAssetsCache::AddNewAsset | ( | const CNewAsset & | asset, |
const std::string | address, | ||
const int & | nHeight, | ||
const uint256 & | blockHash | ||
) |
Cache only add asset functions.
Changes Memory Only.
Definition at line 1836 of file assets.cpp.
bool CAssetsCache::AddOwnerAsset | ( | const std::string & | assetsName, |
const std::string | address | ||
) |
Changes Memory Only.
Definition at line 1979 of file assets.cpp.
bool CAssetsCache::AddQualifierAddress | ( | const std::string & | assetName, |
const std::string & | address, | ||
const QualifierType | type | ||
) |
Changes Memory Only, this only called when adding a block to the chain.
Definition at line 2031 of file assets.cpp.
bool CAssetsCache::AddReissueAsset | ( | const CReissueAsset & | reissue, |
const std::string | address, | ||
const COutPoint & | out | ||
) |
Changes Memory Only.
Definition at line 1857 of file assets.cpp.
bool CAssetsCache::AddRestrictedAddress | ( | const std::string & | assetName, |
const std::string & | address, | ||
const RestrictedType | type | ||
) |
Changes Memory Only, this only called when adding a block to the chain.
Definition at line 2096 of file assets.cpp.
bool CAssetsCache::AddRestrictedVerifier | ( | const std::string & | assetName, |
const std::string & | verifier | ||
) |
Changes Memory Only.
Definition at line 2180 of file assets.cpp.
|
private |
bool CAssetsCache::AddTransferAsset | ( | const CAssetTransfer & | transferAsset, |
const std::string & | address, | ||
const COutPoint & | out, | ||
const CTxOut & | txOut | ||
) |
bool CAssetsCache::CheckForAddressQualifier | ( | const std::string & | qualifier_name, |
const std::string & | address, | ||
bool | fSkipTempCache = false |
||
) |
Return true if the address has the given qualifier assigned to it.
There are circumstances where a blocks transactions could be removing or adding a qualifier to an address, While at the same time a transaction is added to the same block that is trying to transfer to the same address. Depending on the ordering of these two transactions. The qualifier database used to verify the validity of the transactions could be different. To fix this all restricted asset transfer validation checks will use only the latest connect block tips caches and databases to validate it. This allows for asset transfers and address qualifier transactions to be added in the same block without failing validation
Definition at line 4514 of file assets.cpp.
bool CAssetsCache::CheckForAddressRestriction | ( | const std::string & | restricted_name, |
const std::string & | address, | ||
bool | fSkipTempCache = false |
||
) |
Return true if the address is marked as frozen.
There are circumstances where a blocks transactions could be removing or adding a restriction to an address, While at the same time a transaction is added to the same block that is trying to transfer from that address. Depending on the ordering of these two transactions. The address restriction database used to verify the validity of the transactions could be different. To fix this all restricted asset transfer validation checks will use only the latest connect block tips caches and databases to validate it. This allows for asset transfers and address restriction transactions to be added in the same block without failing validation
Definition at line 4593 of file assets.cpp.
bool CAssetsCache::CheckForGlobalRestriction | ( | const std::string & | restricted_name, |
bool | fSkipTempCache = false |
||
) |
Return true if the restricted asset is globally freezing trading.
There are circumstances where a blocks transactions could be freezing all asset transfers. While at the same time a transaction is added to the same block that is trying to transfer the same asset that is being frozen. Depending on the ordering of these two transactions. The global restriction database used to verify the validity of the transactions could be different. To fix this all restricted asset transfer validation checks will use only the latest connect block tips caches and databases to validate it. This allows for asset transfers and global restriction transactions to be added in the same block without failing validation
Definition at line 4651 of file assets.cpp.
bool CAssetsCache::CheckIfAssetExists | ( | const std::string & | name, |
bool | fForceDuplicateCheck = true |
||
) |
Returns true if an asset with this name already exists.
Returns a boolean on if the asset exists.
Definition at line 3271 of file assets.cpp.
|
inline |
bool CAssetsCache::ContainsAsset | ( | const CNewAsset & | asset | ) |
Help functions.
Definition at line 1699 of file assets.cpp.
bool CAssetsCache::ContainsAsset | ( | const std::string & | assetName | ) |
Definition at line 1704 of file assets.cpp.
bool CAssetsCache::DumpCacheToDatabase | ( | ) |
Write asset cache data to database.
Definition at line 2207 of file assets.cpp.
size_t CAssetsCache::DynamicMemoryUsage | ( | ) | const |
Calculate the size of the CAssets (in bytes)
Get the amount of memory the cache is using.
Definition at line 2935 of file assets.cpp.
bool CAssetsCache::Flush | ( | ) |
Flush all new cache entries into the passets global cache.
Do not call this function on the passets pointer.
Definition at line 2750 of file assets.cpp.
bool CAssetsCache::GetAssetMetaDataIfExists | ( | const std::string & | name, |
CNewAsset & | asset | ||
) |
Returns true if an asset with the name exists, and it was able to get the asset metadata from database.
Definition at line 3340 of file assets.cpp.
bool CAssetsCache::GetAssetVerifierStringIfExists | ( | const std::string & | name, |
CNullAssetTxVerifierString & | verifier, | ||
bool | fSkipTempCache = false |
||
) |
Returns true if the Asset Verifier String was found for an asset_name, if fSkipTempCache is true, it will only search passets pointer and databases.
There are circumstances where a blocks transactions could be changing an assets verifier string, While at the same time a transaction is added to the same block that is trying to transfer the assets who verifier string is changing. Depending on the ordering of these two transactions. The verifier string used to verify the validity of the transaction could be different. To fix this all restricted asset transfer validation checks will use only the latest connect block tips caches and databases to validate it. This allows for asset transfers and verify string change transactions to be added in the same block without failing validation
Definition at line 4445 of file assets.cpp.
size_t CAssetsCache::GetCacheSize | ( | ) | const |
Get the size of the none databased cache.
Get an estimated size of the cache in bytes that will be needed inorder to save to database.
Definition at line 2942 of file assets.cpp.
size_t CAssetsCache::GetCacheSizeV2 | ( | ) | const |
Get an estimated size of the cache in bytes that will be needed inorder to save to database.
Definition at line 2978 of file assets.cpp.
|
inline |
bool CAssetsCache::RemoveGlobalRestricted | ( | const std::string & | assetName, |
const RestrictedType | type | ||
) |
Changes Memory Only, this is only called when undoing a block from the chain.
Definition at line 2159 of file assets.cpp.
bool CAssetsCache::RemoveNewAsset | ( | const CNewAsset & | asset, |
const std::string | address | ||
) |
Cache only undo functions.
Changes Memory Only.
Definition at line 1817 of file assets.cpp.
bool CAssetsCache::RemoveOwnerAsset | ( | const std::string & | assetsName, |
const std::string | address | ||
) |
Changes Memory Only.
Definition at line 1998 of file assets.cpp.
bool CAssetsCache::RemoveQualifierAddress | ( | const std::string & | assetName, |
const std::string & | address, | ||
const QualifierType | type | ||
) |
Changes Memory Only, this is only called when undoing a block from the chain.
Definition at line 2062 of file assets.cpp.
bool CAssetsCache::RemoveReissueAsset | ( | const CReissueAsset & | reissue, |
const std::string | address, | ||
const COutPoint & | out, | ||
const std::vector< std::pair< std::string, CBlockAssetUndo > > & | vUndoIPFS | ||
) |
Changes Memory Only.
Definition at line 1913 of file assets.cpp.
bool CAssetsCache::RemoveRestrictedAddress | ( | const std::string & | assetName, |
const std::string & | address, | ||
const RestrictedType | type | ||
) |
Changes Memory Only, this is only called when undoing a block from the chain.
Definition at line 2117 of file assets.cpp.
bool CAssetsCache::RemoveRestrictedVerifier | ( | const std::string & | assetName, |
const std::string & | verifier, | ||
const bool | fUndoingReissue = false |
||
) |
Changes Memory Only.
Definition at line 2194 of file assets.cpp.
bool CAssetsCache::RemoveTransfer | ( | const CAssetTransfer & | transfer, |
const std::string & | address, | ||
const COutPoint & | out | ||
) |
Changes Memory Only.
Definition at line 2016 of file assets.cpp.
Cache only validation functions.
Definition at line 1634 of file assets.cpp.
|
private |
Changes Memory Only.
Definition at line 1790 of file assets.cpp.
std::map<CAssetCacheRootQualifierChecker, std::set<std::string> > CAssetsCache::mapRootQualifierAddressesAdd |
std::map<CAssetCacheRootQualifierChecker, std::set<std::string> > CAssetsCache::mapRootQualifierAddressesRemove |
std::set<CAssetCacheNewAsset> CAssetsCache::setNewAssetsToAdd |
std::set<CAssetCacheNewAsset> CAssetsCache::setNewAssetsToRemove |
std::set<CAssetCacheNewOwner> CAssetsCache::setNewOwnerAssetsToAdd |
std::set<CAssetCacheNewOwner> CAssetsCache::setNewOwnerAssetsToRemove |
std::set<CAssetCacheQualifierAddress> CAssetsCache::setNewQualifierAddressToAdd |
std::set<CAssetCacheQualifierAddress> CAssetsCache::setNewQualifierAddressToRemove |
std::set<CAssetCacheReissueAsset> CAssetsCache::setNewReissueToAdd |
std::set<CAssetCacheReissueAsset> CAssetsCache::setNewReissueToRemove |
std::set<CAssetCacheRestrictedAddress> CAssetsCache::setNewRestrictedAddressToAdd |
std::set<CAssetCacheRestrictedAddress> CAssetsCache::setNewRestrictedAddressToRemove |
std::set<CAssetCacheRestrictedGlobal> CAssetsCache::setNewRestrictedGlobalToAdd |
std::set<CAssetCacheRestrictedGlobal> CAssetsCache::setNewRestrictedGlobalToRemove |
std::set<CAssetCacheRestrictedVerifiers> CAssetsCache::setNewRestrictedVerifierToAdd |
std::set<CAssetCacheRestrictedVerifiers> CAssetsCache::setNewRestrictedVerifierToRemove |
std::set<CAssetCacheNewTransfer> CAssetsCache::setNewTransferAssetsToAdd |
std::set<CAssetCacheNewTransfer> CAssetsCache::setNewTransferAssetsToRemove |
std::vector<CAssetCacheSpendAsset> CAssetsCache::vSpentAssets |
std::vector<CAssetCacheUndoAssetAmount> CAssetsCache::vUndoAssetAmount |