[Core][Script][Wallet][RPC][Tests] Cold Staking#955
[Core][Script][Wallet][RPC][Tests] Cold Staking#955furszy merged 59 commits intoPIVX-Project:masterfrom
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
Pass the script that we are spending to CTransaction::CheckColdStake(), directly from the interpreter. This way, there's no need for additional verifications in CheckTransaction (except for enforcement/activation).
and add a better log message to CheckProofOfStake
to list all P2CS utxos belonging to the wallet (either as cold-staker or coin-owner)
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
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.CheckColdStakefunction, called byCheckTransaction, to check for the rules not verified by the script evaluation (equivalence of input and output scripts).-coldstakingstartup flag to disable cold staking while keeping hot staking enabled (if-staking=1). If-staking=0then-coldstakingis automatically set to0too.2880000for main net,2106100for test net,251for reg test.[Script]
OP_CHECKCOLDSTAKEVERIFYP2CSfColdStaketoExtractDestinationto extract proper keyID from P2CS scripts.[Wallet]
ISMINE_COLD,ISMINE_SPENDABLE_DELEGATED.fStakeDelegationVoidedto walletTx when voiding stake delegations.AvailableCoinsto include cold and/or delegated coins in the selection.SelectStakeCoinsfor cold staking.AvailableCoins.[RPC]
getbalance,senfrom,sendmanyandlisttransactions.getnewstakingaddressto generate a new staking address.delegatestaketo send a stake delegation transactiondelegatestakerawto create a raw stake delegation transaction without sending itsendtoaddress.getcoldstakingbalanceto retrieve the cold balance of the wallet.cold_staking_balanceanddelegated_balancetogetwalletinfo/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.delegatoraddto whitelist an owner address for cold staking.delegatorremoveto un-do the effect ofdelegatoradd.listcoldutxosto show p2cs utxos belonging to the wallet (either as owner or staker).liststakingaddressesto show the staking addresses generated by the wallet.liststdelegatorsto show the delegator (owner) addresses whitelisted by the (cold) wallet.[Tests]
feature_coldStaking.pyfunctional test and addition of it to the test-runner.[Misc/Clenup]
EnsureWalletIsUnlockedin rpcdump.cpp