Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the new MaturityHeightIndex DB needed by the getblockexpanded R…
…PC call (#208) * First backport of address indexing from Zend Todo: - txindex.py not working (neither on Zend repo) * Fixed conflict for DB index tags * Added some furhter code from zen addressIndexing branch; Added handling for spentIndex in disconnect block stage * Updated structures for LevelDB indexes Updated the value structures for the following indexes: - TxIndex - AddressIndex - AddressUnspentIndex * Changed interface to mempool address indexing functions for accepting CTransactionBase * Improved CTxIndexValue constructor * WIP: first versionof code implementation for mempool handling of address indexing data: non tested yet * Changes on getaddressbalance to don't include by default immature BTs, and added new field immature in the response * Changes on getaddressutxo to don't include by default immature BTs and added new field maurityHeight for each utxo * Moved some code for better organization * WIP: Address Index: Added logic for modifying output entries for a cerificate superseeded by a new top quality accepted in mempool * Added python test for getaddress* RPC commands * Minor modifications for certificate handling flow; removed unused code * Improved code related to address indexing * Added getaddressmempool check inside sc_cert_addressindex.py test * Added update of low quality certs in address index data when the top quality cert is evicted from mempool * Changed value of outStatus for input records in address index mempool map (from -1 to 0xff); used GetType() func instead of if/else blocks * Used GetType()/GetAddressHash instead of if/else blocks also in addSpentIndex * Updated the addressindexing Python test with additional scenarios * Added bwt related dat to json result of getaddressutxos rpc cmd * Moved instantiation of height and best block hash at the implementation start using lock in getaddressutxos cmd * Added rpc command getcertmaturityinfo; it relies on txindex option to be on * Implemented explorer indexes update for certificates in the ConnectBlock * Moved to_satoshis() func into util.py * Fixed the serialization of "maturityHeight" for the SpentIndex * Updated sc_cert_addressindex to test the DisconnectTip * Implemented indexes update for certificates in the DiconnectBlock * Implemented indexes update when sidechain ceased state changes * Added sc_cert_addrmempool.py test expecially aimed at getaddressmempool rpc command * Added vcsw_ccin field inside TxToJSONExpanded * Minor fixes for indexes management - Removed some unused input parameters - Added a flag check inside the DisconnectBlock function * Added new index update test cases for ceased sidechains * Fix for py test using createrawcertificate * Improved AddressIndex update procedure Improved the code so that AddressIndex entries are removed and updated in one single batch operation (instead of two different ones). * Improved code reuse for serialization of VARINT with sign * Fixed issues after rebasing onto testnet_staging * Added a conditional compilation flag for AddressIndex related features * Fixed a flag for optionally run address indexing Python tests * Added extended information to certificate JSON representation * Added some code under address indexing conditional compilation * Fixed the regression tests * Improved management of the -addressindex parameter * Removed some debug prints from the build configuration file * Fix Python test failing after extending getrawtransaction JSON fields * Fixed a Python test failing after requiring txIndex for addressIndex * Renamed JSON field 'valueSat' as 'valueZat' * Put additional code under conditional compilation for Address Indexing * Removed unused references to wallet-utility * Improved comment about address-indexing flag * Added comments to #endif for ENABLE_ADDRESS_INDEXING macro * Removed nonexistent header from Makefile * Added some LevelDB collection IDs into the Address Indexing section * Improved management of flags "dbmaxopenfiles" and "dbcompression" - Renamed "dbmaxopenfiles" as "blocktreedbmaxopenfiles" - Renamed "dbcompression" as "blocktreedbcompression" - Put both flags under #ifdef - Fixed the default options for the Block Tree LevelDB * Moved blockOnchainActive() function under #ifdef * Moved some Address Indexing related code under #ifdef * Fixed the implementation of blockOnchainActive() function * Added to ConnectBlock a flag to skip writing Address Indexing DB * Restored some code to the previous location * Added management for TxIndex update during Connect/Disconnect of block * Substituted an assert with an if, since we must update the txindex entry only if it is there * Added the state INVALID to the output of the rpc cmd getcertmaturityinfo * Fixed txindex.py test and added it to regression script * Added checks to update TxIndex DB only if the related flag is enabled * Added some test for getcertmaturityinfo; to be continued * Included search in the mempool for the RPC command getcertmaturityinfo * Fixed sc_cert_addrmempool.py test * Added a test case for a certificate removed from the blockchain - Added the new test case to sc_cert_addrmempool.py - Added a new RPC command to clear the mempool of a node (REGTEST only) * Added the cleanup of other data structures in the mempool clean() method * Enabled clearmempool rpc command also for testnet * Changed the status string of a mempool cert in the output of rpc cmd getcertmaturityinfo * Added a flag to enable/disable write of TxIndex when checking blocks * Moved a variable initialization into the correct scope * Added verifychain rpc call to py tests * Added maturityHeightIndex DB * Fix after rebase * Added new flag to enable the maturityHeightIndex DB * Added a comment to the CMaturityHeightValue * Fix after code review * Restore previous serialization of MaturityHeightIndex keys * Removed the txindex dependency from the maturityHeight DB * New error handling inside ReadMaturityHeightIndex * Removed print from ReadMaturityHeightIndex * Minor fix * Re-added txindex and a couple of other fixes Co-authored-by: Paolo Tagliaferri <paolotagliaferri@horizenlabs.io> Co-authored-by: Alberto Sala <alberto.sala@nttdata.com>
- Loading branch information