Open levonpetrosyan93 opened 2 weeks ago
The changes in this pull request introduce significant updates to the blockchain's handling of Spark transactions, including modifications to data structures, serialization logic, and transaction validation. Key updates include the introduction of new consensus parameters for Spark, enhancements to the CBlockIndex
class to manage minted coins with boolean flags, and the integration of Spark address handling throughout various components, including wallets and RPC functions. Additionally, the wallet's transaction management has been refined to accommodate Spark and Lelantus features, ensuring robust validation and error handling.
File | Change Summary |
---|---|
src/chain.h |
Updated sparkMintedCoins from std::map<int, std::vector<spark::Coin>> to std::map<int, std::vector<std::pair<spark::Coin, bool>>> . Added conditional serialization logic based on block height. |
src/chainparams.cpp |
Added consensus.nSparkStartBlock and consensus.nSparkCoinbase to CMainParams , CTestNetParams , CDevNetParams , and CRegTestParams . Added Lelantus and Sigma parameters. |
src/consensus/params.h |
Introduced int nSparkCoinbase to Params struct. |
src/evo/deterministicmns.cpp |
Enhanced ToString and ToJson methods in CDeterministicMNState to handle payout addresses using spark::ToStringSparkAddress . |
src/evo/providertx.cpp |
Updated CheckProRegTx , CheckProUpServTx , and CheckProUpRegTx functions to validate payout scripts as Spark addresses. Modified ToString and ToJson methods for Spark address representation. |
src/libspark/coin.cpp |
Updated Coin constructor to accept COIN_TYPE_COINBASE . Added isValidMNPayment method. Enhanced handling for coin types. |
src/libspark/coin.h |
Added const char COIN_TYPE_COINBASE = 2; and updated serialization logic to include this new type. |
src/libspark/keys.cpp |
Added toByteVector and fromByteVector methods to Address class for address conversion. |
src/libspark/keys.h |
Added declarations for toByteVector and fromByteVector methods in Address class. |
src/libspark/mint_transaction.cpp |
Updated MintTransaction constructor to accept output.type for flexible coin types. |
src/libspark/mint_transaction.h |
Added char type to MintedCoinData struct. |
src/masternode-payments.cpp |
Commented out IsOldBudgetBlockValueValid . Simplified IsBlockValueValid . Enhanced GetRequiredPaymentsString and logging in GetMasternodeTxOuts . Expanded IsTransactionValid to include mint outputs. |
src/miner.cpp |
Enhanced CreateNewBlock to process Spark-related outputs and create Spark mint recipients. |
src/qt/masternodelist.cpp |
Added support for Spark addresses in masternode handling. Introduced variables for parameters and network type. |
src/qt/walletmodel.cpp |
Added validateSparkAddress method. Introduced methods for minting and spending Spark coins. Enhanced error handling in transaction preparation methods. |
src/rpc/mining.cpp |
Enhanced handling of masternode payments and integrated Spark address support in mining RPC functions. |
src/rpc/rpcevo.cpp |
Introduced parseSparkAddress function for Spark address validation. Updated protx_register , protx_update_service , and protx_revoke functions to handle Spark addresses. |
src/spark/sparkwallet.cpp |
Updated CSparkWallet constructor to accept height . Modified balance calculation methods to consider coin maturity. |
src/spark/sparkwallet.h |
Updated constructor to require uint32_t height . Changed RemoveSparkMints method to accept pairs of coins and boolean flags. |
src/spark/state.cpp |
Updated CheckSparkMintTransaction to include isCoinbase parameter. Added functions for Spark address validation and conversion. Enhanced CheckSparkSpendTransaction . |
src/spark/state.h |
Updated CSparkTxInfo to store mints as pairs with boolean flags. Added functions for Spark address handling. |
src/test/spark_state_test.cpp |
Updated PopulateSparkTxInfo method to accept pairs of coins and boolean flags. Adjusted test cases accordingly. |
src/test/spark_tests.cpp |
Enhanced tests for Spark transactions, improved error handling, and refined state management in tests. |
src/test/test_bitcoin.cpp |
Updated CSparkWallet instantiation in TestingSetup to include height parameter. |
src/validation.cpp |
Enhanced CheckTransaction and AcceptToMemoryPool to include checks for Spark transactions. |
src/wallet/wallet.cpp |
Updated transaction handling to accommodate Spark and Lelantus features. Added methods for listing and creating Spark transactions. |
src/wallet/wallet.h |
Added static const bool DEFAULT_SPARK_REWARD . |
sparkMintedCoins
member variable and its serialization logic in the main PR.In the burrows of code, where the changes take flight,
Spark coins now shimmer, a beautiful sight.
With mints and new types, our blockchain's aglow,
Hopping through logic, where bright ideas flow.
So here’s to our updates, both clever and bright,
A leap for the future, in the soft moonlight! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Spark coinbase implementation After HF block there is allowed to create coinbase transactions with spark outputs. It supports also masternode owners to put spark address as payout address. for this we need to make
k
value public inside spark coin to allow verify that the con is generated to the right address, for other spark coinsk
is not supposed to be public, otherwise it will break privacy, We also implemented immature period for spark coinbase outputs, it is the same as regular coinbase outputs, 100 blocks,