-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core][Script][Wallet][RPC][Tests] Cold Staking #955
Conversation
5fde942
to
2b3a4a4
Compare
6e60e4b
to
330fe54
Compare
This looks great actually, good job @random-zebra |
330fe54
to
54915f2
Compare
@giaki3003 I think that it would cause more confusion, as "Cold" staking is a rather loose term, used for many forms of "proxied" or "offline" staking already, while DPoS is a specific consensus algorithm (which is not what we have here). Anyway, that's open for debate. Feel free to add your opinion here, if you want: https://forum.pivx.org/index.php?threads/pivx-cold-staking.324/ |
@random-zebra nothing major, just a thought since this reminds me of the similar delegated staking other PoS coins have, which they usually call TPoS/DPoS. Probably would only add extra confusion |
Needs Rebase |
55d4bb7
to
f621581
Compare
rebased |
48877c5
to
4ac877d
Compare
31ba8fa
to
2227833
Compare
8ff00e2
to
aaab471
Compare
…t instead of 3 doing exactly the same.
…method. [Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount method.
to verify that the last output of cold stakes has the correct amount regardless of the payee (which is checked in IsBlockPayeeValid). This prevents possible abuse when SPORK_8 and/or SPORK_9-SPORK_13 are disabled). Also adjust/cleanup feature_coldStaking functional test
aaab471
to
e498a06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK e498a06
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK e498a06
e498a06 [Core] Cold Staking: lower dust threshold to 1 PIV (random-zebra) 255d757 [Core] Add CheckColdStakeFreeOutput function (random-zebra) 3bfc380 [Tests] Speed up feature_coldStaking + check 'listcoldutxos' (random-zebra) 244feca [Wallet] Fix spending P2CS delegations with coin control (random-zebra) 620bc19 [Bug] Fix isMine type in GetColdStakingDebit (random-zebra) 6cadfea [Wallet] Add fStakeDelegation voided in-memory flag (random-zebra) 80678b7 [Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount method. (furszy) bf27e84 [Wallet] Stop duplicating cached amount update. Single method doing it instead of 3 doing exactly the same. (furszy) 436f383 [Wallet] Add fUnspent flag to GetCredit (random-zebra) b33c6bc [Wallet] define GetColdStakingDebit and GetStakeDelegationDebit (random-zebra) 16fa605 [RPC] define liststakingaddresses (random-zebra) 23ecdee [RPC] define listdelegators (random-zebra) 2f246d2 [Wallet] fix IsValid and validateaddress for Staking Addresses (random-zebra) b20bc52 [RPC] define getdelegatedbalance (random-zebra) d81ecdc [Wallet] don't include P2CS in SelectStakeCoins if CS is not enabled (random-zebra) f7f7119 [Trivial][RPC] Fix delegatoradd help text and remove extra arg fRescan (random-zebra) 87327fc [RPC] listcoldutxos: include only final, trusted, unspent coins (random-zebra) 5209c3f [DB] Fix unserialization check for cold staking txes (random-zebra) 968931e [RPC] listcoldutxos: fix staking addresses base58 prefix (random-zebra) 4000b6e [RPC] Define listcoldutxos function (random-zebra) f771f86 [Trivial] define GetSakingBalance and update it in miner (random-zebra) 5383f52 [Fix] MintableCoins include cold staking balance (random-zebra) 7ce9432 [Tests] Fix coldstaking functional test (random-zebra) 618afdb [Tests] Additional case for Cold Staking functional test (random-zebra) 75b8861 [Script] Unify OP_CHECKCOLDSTAKEVERIFY checks (random-zebra) 2a5bae7 [Script] Guard against GetPubKey() failures in Solver() (random-zebra) e67c152 [Cleanup] minor styling in standard.cpp and remove fStakeDelegationVoided in wallet (random-zebra) f20e1a6 [RPC] CreateColdStakeDelegation move checks before creating address (random-zebra) 9c8a656 [Wallet] Speed up ColdStaking and Delegated balance computation (random-zebra) 61e9d6e [Consensus] Fix output index in CheckColdStake() (random-zebra) 0f09fce [Core] Init CBitcoinAddress and Visitor with base58 prefix instead of bool flag (random-zebra) 374a78c [Tests] Fix Script UnitTests data (random-zebra) c723ab6 [Core] Add threshold for P2CS value (hardcoded to 10 PIV) (random-zebra) 6e28ec1 [Core] prevent abuse on mn output when spork 8 is disabled (random-zebra) ad6bee1 [Wallet][DB] Refactor Delegator whitelist as AddressBook entry (random-zebra) 6c1d399 [Trivial] Fix spelling in delegatorremove RPC help (random-zebra) c5de40f [Cleanup] Fix linter (random-zebra) 1d071f4 [Tests] Add Cold Staking functional testing (random-zebra) 8b56c33 [RPC] define: delegatoradd, delegatorremove (random-zebra) 8bc0893 [Wallet/DB] Add Delegators-whitelist protection for cold staker (random-zebra) 4064423 [Consensus] ColdStaking enforcement (random-zebra) 1d69ef3 [Wallet] Add -coldstaking flag to enable/disable feature (random-zebra) bff6c9e [RPC] signrawtransaction: select proper key for 'cold' inputs (random-zebra) e546ec6 [Core][Tests] REGTEST: fix nStakeModifier (random-zebra) 92515c3 [Core] add main P2CS check in CheckTransaction (random-zebra) 661083d [Core] Sign block with staking key if coinstake is 'cold' stake (random-zebra) f30c299 [Wallet] Use cold inputs to stake (random-zebra) cdb758b [RPC] define getcoldstakingbalance (random-zebra) 8ac0ed3 [Script] Add fColdStake to ExtractDestination (random-zebra) e19bfa4 [Wallet] Add flag 'fStakeDelegationVoided' to tx when P2PC gets spent (random-zebra) ca90d02 [Script] Sign P2CS scripts (random-zebra) dea30c7 [Script] Define IsPayToColdStaking() fast test (random-zebra) e8abd21 [Cleanup] Remove re-declaration of EnsureWalletIsUnlocked in rpcdump (random-zebra) 97b6332 [RPC/Wallet] fix IsMine filters and add option to include delegated balance in calls (random-zebra) b709748 [RPC] define: getnewstakingaddress, delegatestake, rawdelegatestake (random-zebra) f6bba23 [Wallet] Get ColdStaking/Delegated balance (random-zebra) c7d1934 [Core] define TX_COLDSTAKE standard and P2CS script (random-zebra) 6ec51f4 [Script] Define OP_CHECKCOLDSTAKEVERIFY opcode behaviour (random-zebra) 0fb6ca1 [Core] Define STAKING_ADDRESS addresses (random-zebra) Pull request description: Implements the "Cold Staking" system described in https://github.com/random-zebra/PIVX-Wiki/blob/master/Developer-Documentation/Specs/ColdStaking.mediawiki. Closes #579. The current changeset does not include any edit to the GUI, as it is being redesigned for v4.0.0 (#954). The controls for cold staking will be added to the new interface in a separate PR if this upgrade is approved. Enforcement activation height uses placeholder values for now. Notable changes: - [Core] * Definition of the new type of address `STAKING_ADDRESS`. * Definition of a new standard transaction type `TX_COLDSTAKE`. * Block signature/validation change: sign blocks with the staker private key, verify the signature extracting the public key from the coinstake input. * Addition of `CheckColdStake` function, called by `CheckTransaction`, to check for the rules not verified by the script evaluation (equivalence of input and output scripts). * Addition of `-coldstaking` startup flag to disable cold staking while keeping hot staking enabled (if `-staking=1`). If `-staking=0` then `-coldstaking` is automatically set to `0` too. * Definition of placeholders for the activation block height: `2880000` for main net, `2106100`for test net, `251` for reg test. * Definition of threshold value for cold staking outputs - [Script] * Definition of a new opcode `OP_CHECKCOLDSTAKEVERIFY` * Definition of the output script `P2CS` * Definition of a fast test to recognize P2CS scripts by checking only few bytes. * Definition of the input scriptSig to spend P2CS scriptPubKey outputs * Addition of a boolean argument `fColdStake` to `ExtractDestination` to extract proper keyID from P2CS scripts. - [Wallet] * Introduction of new ismine types to recognize cold staking txes: `ISMINE_COLD`, `ISMINE_SPENDABLE_DELEGATED`. * Introduction of the concepts of "delegated" and "cold" balance (debit and credit) * Addition of a new boolean flag `fStakeDelegationVoided` to walletTx when voiding stake delegations. * Addition of 2 new boolean optional arguments to `AvailableCoins` to include cold and/or delegated coins in the selection. * Inclusion of delegated coins in `SelectStakeCoins` for cold staking. * Addition of the delegator whitelisting check in `AvailableCoins`. - [RPC] * Addition of an option to include delegated balance in `getbalance`, `senfrom`, `sendmany` and `listtransactions`. * Definition of new method `getnewstakingaddress` to generate a new staking address. * Definition of new method `delegatestake` to send a stake delegation transaction * Definition of new method `delegatestakeraw` to create a raw stake delegation transaction without sending it * Prevent the use of staking addresses as recipients in `sendtoaddress`. * Definition of new method `getcoldstakingbalance` to retrieve the cold balance of the wallet. * Addition of `cold_staking_balance` and `delegated_balance` to `getwalletinfo`/`getinfo`. * `signrawtransaction`: for P2CS, select the key used to sign based on what is found in the keystore. If the wallet has both keys, sign with the owner key. * Definition of new method `delegatoradd` to whitelist an owner address for cold staking. * Definition of new method `delegatorremove` to un-do the effect of `delegatoradd`. * Definition of new function `listcoldutxos` to show p2cs utxos belonging to the wallet (either as owner or staker). * Definition of new function `liststakingaddresses` to show the staking addresses generated by the wallet. * Definition of new function `liststdelegators` to show the delegator (owner) addresses whitelisted by the (cold) wallet. - [Tests] * Creation of the new `feature_coldStaking.py` functional test and addition of it to the test-runner. - [Misc/Clenup] * Remove extra declaration of `EnsureWalletIsUnlocked` in rpcdump.cpp * REGTEST: lower the confirmations to 15 (same as testnet) and fix the stakeModifier. ACKs for top commit: Fuzzbawls: ACK e498a06 furszy: ACK e498a06 Tree-SHA512: 3dc3d5a50bc89c9ebfd5c84ab28ceec1166242b8ceedf62231e497bd432b9f49986f9d0e5ea442d44891f1ccc109dfe74f3e14125f2c18cd1b369f24127654ad
fffc6c5 [Core] Lower the banscore for P2CS when spork 17 disabled to 10 (random-zebra) 20effe6 [Consensus] Set Cold Staking activation via SPORK (random-zebra) Pull request description: This is based on top of #955 (only the last commit, 5a6eab5 , is relevant for this PR). It sets Cold Staking activation via SPORK instead of having it height-based. When `SPORK_17_COLDSTAKING_ENFORCEMENT` is **not** active (default), transactions with P2CS outputs are rejected on the network. This way only cold-staking and new delegations are disabled while coin-owners can still spend their coins. ACKs for top commit: furszy: ACK fffc6c5 Fuzzbawls: ACK fffc6c5 Tree-SHA512: bac8e267d0c6f74896cf6915c67de6880d033aaf757f3ac0564bf816bf5fa5abe91b41dc8f90328e8a028026ddd1e6636023c6bcc405041813841ee231e22565
fffc6c5 [Core] Lower the banscore for P2CS when spork 17 disabled to 10 (random-zebra) 20effe6 [Consensus] Set Cold Staking activation via SPORK (random-zebra) Pull request description: This is based on top of PIVX-Project/PIVX#955 (only the last commit, 5a6eab590505d409481ee3f385d65b09f40bb8fd , is relevant for this PR). It sets Cold Staking activation via SPORK instead of having it height-based. When `SPORK_17_COLDSTAKING_ENFORCEMENT` is **not** active (default), transactions with P2CS outputs are rejected on the network. This way only cold-staking and new delegations are disabled while coin-owners can still spend their coins. ACKs for top commit: furszy: ACK fffc6c5 Fuzzbawls: ACK fffc6c5 Tree-SHA512: bac8e267d0c6f74896cf6915c67de6880d033aaf757f3ac0564bf816bf5fa5abe91b41dc8f90328e8a028026ddd1e6636023c6bcc405041813841ee231e22565
fffc6c5 [Core] Lower the banscore for P2CS when spork 17 disabled to 10 (random-zebra) 20effe6 [Consensus] Set Cold Staking activation via SPORK (random-zebra) Pull request description: This is based on top of PIVX-Project/PIVX#955 (only the last commit, 5a6eab590505d409481ee3f385d65b09f40bb8fd , is relevant for this PR). It sets Cold Staking activation via SPORK instead of having it height-based. When `SPORK_17_COLDSTAKING_ENFORCEMENT` is **not** active (default), transactions with P2CS outputs are rejected on the network. This way only cold-staking and new delegations are disabled while coin-owners can still spend their coins. ACKs for top commit: furszy: ACK fffc6c5 Fuzzbawls: ACK fffc6c5 Tree-SHA512: bac8e267d0c6f74896cf6915c67de6880d033aaf757f3ac0564bf816bf5fa5abe91b41dc8f90328e8a028026ddd1e6636023c6bcc405041813841ee231e22565
93f6bfe [GUI] Cold staking my address menu position corrected. (furszy) 804be96 [Model] isP2CSSpend and isDelegatedToOrFromMe unused method removed. (furszy) 6928080 [GUI][Model] * TransactionRecord implementing isAnyColdStakingType to know if the tx is a cold staking tx in any way. * txArrived signal now including the isAnyColdStakingType flag to prevent reiterative calls (and thereby cs_wallet locks in the UI thread) when the information was already cached. (furszy) 75968f9 [GUI][Model] Rebase fix (furszy) 7efda4b [GUI] MasterNodesWidget, list view mouse tracking enabled. (furszy) 3359aa7 [Wallet] GetAvailableP2CSCoins, a p2cs utxo is spendable only if IsMine == ISMINE_SPENDABLE_DELEGATED. (furszy) ec0f537 [Wallet] GetAvailableP2CSCoins improved. (furszy) 8caed35 [GUI] TransactionDetailDialog, showing the cold staking addresses outputs correctly. (furszy) 6016f0d [Helpers] CBitcoinAddress, newInstance and newCSInstance method created to not require CChainParams dependency in every file that needs to parse a different type of address. (furszy) d7a6ae4 [GUI][Model] TransactionRecord, invalid cold staking delegations credit calculation fixed. (furszy) c1cb8f8 [UI][Model] ColdStaking screen, my staking addresses list, menu with copy and edit actions connected. (furszy) bc7382a [Model][UI] isColdStakingNetworkelyEnabled method created and connected to the UI. (furszy) 8bef7d3 [Wallet] fix getNewAddress returning error with locked wallet (random-zebra) ceca5d7 [Wallet] Fix getNewAddress methods (random-zebra) 565d347 [Build] CMake missing addressholder file added. (furszy) ad8217c [GUI] Cold staking screen, delegations load moved from main thread to a background worker thread. (furszy) dbd3f07 [GUI] Cold staking screen, shutdown segfault over spacer freed pointer fixed. (furszy) 38e3052 [GUI] Cold staking, stakeable total amount label added and connected. (furszy) e0183c3 [Model] Use ExtractDestinations to get recipients of P2CS scripts (random-zebra) e2b0f48 [GUI] My cold staking addresses list created and connected to the cold staking screen. (furszy) 8334354 [WALLET] Cold staking address book purpose added. (furszy) ef232f8 [GUI] Cold staking, copy owner address instead of the staking address. Staking addresses should be presented in a separate dialog, can have many of them with the same owner. (furszy) fd3bfd1 [GUI] Cold staking, copy staking address button in the tooltip menu created. (furszy) e1cc267 [GUI] Cold staking, owner address change label functionality added. (furszy) 6549bcd [Model][SQUASH] ColdStaking model refresh list fully refactored. (furszy) 6b55bfd [Model][SQUASH] Only update staking addresses. (furszy) 8fdbe6c [Model] TransactionRecord P2CS, set only staking address (furszy) dcd383f [Wallet][Refactor] HasP2CSInputs moved from CTransaction to CWalletTx. (furszy) 2c8ea79 [Model] Cold staking model clearing list one every refresh. (furszy) 4307a96 [GUI] sendConfirm dialog, labelWarning invisible if it's not set. (furszy) 9908597 [Wallet][GUI] Add warning when voiding cold-stake delegation (random-zebra) d587aa9 [Model][GUI][Refactor] CachedDelegation list moved from transactionTableModel to ColdStakingModel. Loaded from the available P2CS utxo in the wallet. (furszy) c2ef93b [Wallet] GetAvailableP2CSCoins method created, returning the stakeable P2CS utxo. (furszy) 4c5be59 [Model][Refactor] TransactionRecord, ExtractAddress for p2cs script method added. (furszy) 976ad63 [Model] P2CS unlock, not using the input.prevPubKey anymore (it's never set by the wallet), instead it's looking for the tx and output inside the wallet map. (furszy) 8e3f1ba [Model] TransactionRecords P2CSUnlockOwner and P2CSUnlockStaker created to represent the p2cs utxo spending of the owner in the hot/cold wallet side. (furszy) 67279c9 [Wallet] Transaction HasP2CSInputs implemented. (furszy) fd2ca98 [Model] Cached cold staking delegations, counting every p2cs record and not only delegation records + update cachedDelegations list using object reference. (furszy) 6298ca8 [Model] Cold Staking model, no need to check an unused parent. (furszy) 8a5bb4b [GUI][Model] Cold Staking whitelist/blacklist only accepting regular addresses, not staking addresses. (furszy) 1a7794e [GUI][Model] * ColdStaking screen: Show/Hide empty view. * TransactionTableModel double check that the tx pointer is not null. (furszy) 75baa86 [Coins] IsOutputAvailable badly checking if the output is available fix (was checking if the output is not available). (furszy) 8763b7b [GUI] Navigation bar, receive icon invalid top padding removed. (furszy) 5b4c17d [Model] Cold staking, debit amount inverted to be inline with the rest of the records. (furszy) 297ffdb [GUI] Cold/Hot stakes tx row icon in every different form for every theme added. (furszy) a11cb87 [Model] TransactionRecord, using GetColdStakingDebit and GetStakeDelegationDebit methods instead of direct access to the amount cache. (furszy) 7b2ac77 [Model] TransactionTablemodel checkForDelegations adding only available p2cs utxo to the cached delegations list. (furszy) 2f953d2 [Chain] IsOutputAvailable method created in coinsViewCache. (furszy) dc777a5 [Model] Cold staking received delegation amount using getColdStakingCredit correctly instead of getDelegatedCredit. (furszy) e8c62d8 [GUI] Cold staking, coin-owner cannot whitelist/blacklist staking addresses, "delegation" wording instead of "staking / not staking". (furszy) 4cc773d [GUI] Cold staking inactive icon on txs row in dark theme added. (furszy) 048c810 [GUI] Cold staking clear all button functionality added and connected. (furszy) 02565ab [GUI] Cold staking nav icon style in dark theme added. (furszy) 063569e [Build] ColdStaking, guiTransactionsUtils and addressbook files added to the cmake files. (furszy) 440179b [GUI] Transaction record bad parsed as MN reward fixed. (furszy) 87a5329 [GUI] ColdStaking screen, hide menu on mode change (furszy) e8a9f21 [GUI][Model] * P2CS records, P2CSDelegationSent type created for spendable. * ColdStaking, Staker screen not showing P2CSDelegationSent stake/blacklist options. * Dashboard filter by delegated txs (furszy) ba8c1c0 [AddressBook] addressbook.cpp file created. (furszy) 79edac6 [Model] WalletModel isMine address, input QString instead of CBitcoinAddress created. (furszy) 9283315 [GUI][Model] * ColdStaking screen, sendMultiRow only accept staking addresses. (furszy) 6460964 [GUI][Model][Refactor] AddressBook namespace created + validateStakingAddress method created in walletModel. (furszy) bb075c6 [GUI] SendMultiRow. * Invalid parse of the comma character fix. * Validate only for staking addresses in coldStaking address editable box. (furszy) a79ce0f [GUI] Request dialog uri amount value set fix. (furszy) 4ca682c [GUI] * RequestDialog permitting 0 amount value staking URI creation. * ContactsDropdown not null object set as null in object creation. (furszy) bb55578 [Model] Do not look for address label if the input address is empty (furszy) ae1efae [Wallet] Base58, do not try to parse an empty string on SetString initialization. (furszy) 8c7eb44 [GUI] Cold staking, auto-completable contacts and delegators connected. * contacts dropdown menu supporting type change and invalidation. (furszy) 7d1185c [Model] * AddressTableModel supporting delegator and delegable addresses. * AddressFilterProxy, method to change the type and invalidate the filter created. (furszy) c7753d4 [GUI] Cold staking, owner contacts on click style. (furszy) 8852f4f [GUI] Cold staking, update delegators list if a new p2cs tx arrives connected. (furszy) 5101902 [Model] * TransactionTableModel, update cachedDelegations when new p2cs output is received. * WalletModel, isDelegatedToMe method created. (furszy) 090daee [GUI] Cold Staking screen, delegate button margin corrected. (furszy) 988c250 [GUI] Cold Staking screen, white/black listing tooltip flag not using the proper index fixed. (furszy) 8e10dfe [GUI] cold staking model update list fix. (furszy) bc2caeb [WalletModel] getKeyId not accepting staking addresses fixed. (furszy) 0b318ff [GUI] RequestDialog requesting address label for cold staking addresses generation. * topbar showing cold stake screen if it's enabled in qsettings. (furszy) 78102f1 [GUI] receiveWidget, moving cold staking address creation to the cold staking widget. (furszy) 5e48f68 [GUI] Cold staking screen: * cs list row implemented. * delegators list view created and connected. * tooltip menu connected. * whitelist/blacklist connected. (furszy) c6eed4c [Model] Cold Staking model created. (furszy) 3d12a03 [Model] * TransactionsTableModel caching stake delegations on startup. * AddressTableModel get purpose for address method created. (furszy) 34bdffa [WalletModel] Cold staking whitelisting and blacklisting methods created. (furszy) 30fa728 [Trivial] [Squash] license + auto-generated name removed. (furszy) 30d296b [Wallet][RPC][Cold Staking] `delegatorremove`, Instead of remove the address from the address book, update the purpose to "delegable" to be whitelisted again, in the future, if the user wants it. (furszy) 29e4914 [Wallet][Refactor] * AddressBookData class moved to it's own addressbook file. First step towards a cleaner wallet.h/cpp file. * AddressBookPurpose string const types created. (furszy) 5daacf8 [GUI] Dark theme icon for P2CS tx added. (furszy) 223acec [GUI][Model][Options] * Cold staking screen visible/invisible flow. * Top bar on, off and active icons. * WalletModel isColdStakingEnabled method created. (furszy) 5645358 [GUI] Cold staking filtering. (furszy) e6fcfbc [GUI] Cold Staking, Owner address connected. (furszy) b43e813 [GUI] Cold Staking, P2CS delegation flow created. (furszy) fa25b18 [GUI] Send widget, delete dialog if it's not used anymore. (furszy) 6588860 [Model] WalletModel P2CS transactions connected. (furszy) e508ad0 [GUI] ProcessSendCoinsReturn method moved to GuiTransactionsUtils to be used in other screens that needs it. (furszy) 2b95a11 [GUI] Generate cold staking address connected. (furszy) b331677 [GUI] TransactionRecord representing P2CS address correctly. (furszy) 12bb7bf [GUI] Dashboard, P2CS contract transaction inactive icon. (furszy) 58c3781 [GUI][Model] Dashboard, P2CS contract transaction connected. (furszy) 52f29ee [Spork] Segfault when spork value exceeds the bounds of ctime conversion fixed. (furszy) af7047d [GUI][Model] Cold staking balance connected to the total balance. (furszy) 1ad01a4 [Refactor] Wallet key creation, stop throwing a runtime_error if the wallet is locked, returning false plus the status error message. (furszy) 9defbad [GUI][Model] Cold staking connected to transactionTableModle and dashboard txs list (resources added). (furszy) e1e5481 [Trivial] Compiler warnings over the overrided methods fix. (furszy) 51db234 [Wallet][RPC] getNewAddress and getNewStaking address methods created and generalized. (furszy) Pull request description: Work in progress PR on top of #955 . Making it public to be able to use it in the segregated testnet network that we are currently running. The UI without a solid tested backend can always change, will detail the work and functionality once the backend testing period gets close to be finalized. ACKs for top commit: Fuzzbawls: ACK 93f6bfe Warrows: ACK 93f6bfe random-zebra: ACK 93f6bfe and merging... Tree-SHA512: ca6e5333e26b5d556ea47ea3d9bae1781779e3e7a98a10fba562183c295c7b905e8de3c02cb0c5f6e8a3578a594082c25461ddbb7f5a88abba8c078d3903f7c6
fffc6c5ea36513ce2508e0021d7eb715cb445206 [Core] Lower the banscore for P2CS when spork 17 disabled to 10 (random-zebra) 20effe6a843e6141c02b9ac3f4be0652d9baea10 [Consensus] Set Cold Staking activation via SPORK (random-zebra) Pull request description: This is based on top of PIVX-Project/PIVX#955 (only the last commit, 5a6eab590505d409481ee3f385d65b09f40bb8fd , is relevant for this PR). It sets Cold Staking activation via SPORK instead of having it height-based. When `SPORK_17_COLDSTAKING_ENFORCEMENT` is **not** active (default), transactions with P2CS outputs are rejected on the network. This way only cold-staking and new delegations are disabled while coin-owners can still spend their coins. ACKs for top commit: furszy: ACK fffc6c5 Fuzzbawls: ACK fffc6c5ea36513ce2508e0021d7eb715cb445206 Tree-SHA512: bac8e267d0c6f74896cf6915c67de6880d033aaf757f3ac0564bf816bf5fa5abe91b41dc8f90328e8a028026ddd1e6636023c6bcc405041813841ee231e22565 # Conflicts: # src/main.cpp # src/spork.cpp # src/sporkid.h
Implements the "Cold Staking" system described in https://github.com/random-zebra/PIVX-Wiki/blob/master/Developer-Documentation/Specs/ColdStaking.mediawiki.
Closes #579.
The current changeset does not include any edit to the GUI, as it is being redesigned for v4.0.0 (#954).
The controls for cold staking will be added to the new interface in a separate PR if this upgrade is approved.
Enforcement activation height uses placeholder values for now.
Notable changes:
[Core]
STAKING_ADDRESS
.TX_COLDSTAKE
.CheckColdStake
function, called byCheckTransaction
, to check for the rules not verified by the script evaluation (equivalence of input and output scripts).-coldstaking
startup flag to disable cold staking while keeping hot staking enabled (if-staking=1
). If-staking=0
then-coldstaking
is automatically set to0
too.2880000
for main net,2106100
for test net,251
for reg test.[Script]
OP_CHECKCOLDSTAKEVERIFY
P2CS
fColdStake
toExtractDestination
to extract proper keyID from P2CS scripts.[Wallet]
ISMINE_COLD
,ISMINE_SPENDABLE_DELEGATED
.fStakeDelegationVoided
to walletTx when voiding stake delegations.AvailableCoins
to include cold and/or delegated coins in the selection.SelectStakeCoins
for cold staking.AvailableCoins
.[RPC]
getbalance
,senfrom
,sendmany
andlisttransactions
.getnewstakingaddress
to generate a new staking address.delegatestake
to send a stake delegation transactiondelegatestakeraw
to create a raw stake delegation transaction without sending itsendtoaddress
.getcoldstakingbalance
to retrieve the cold balance of the wallet.cold_staking_balance
anddelegated_balance
togetwalletinfo
/getinfo
.signrawtransaction
: for P2CS, select the key used to sign based on what is found in the keystore. If the wallet has both keys, sign with the owner key.delegatoradd
to whitelist an owner address for cold staking.delegatorremove
to un-do the effect ofdelegatoradd
.listcoldutxos
to show p2cs utxos belonging to the wallet (either as owner or staker).liststakingaddresses
to show the staking addresses generated by the wallet.liststdelegators
to show the delegator (owner) addresses whitelisted by the (cold) wallet.[Tests]
feature_coldStaking.py
functional test and addition of it to the test-runner.[Misc/Clenup]
EnsureWalletIsUnlocked
in rpcdump.cpp