-
Notifications
You must be signed in to change notification settings - Fork 173
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
Remove 0123 0124 detection to determine POS/POR #1270
Conversation
Should fix #303 |
I agree. The 123/4 should be removed from the POR reward calculations now that we are redoing the reward output ID for display.
…Sent from my iPhone
On Aug 20, 2018, at 3:22 AM, Tomáš ***@***.***> wrote:
Should fix #303
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
with tests from this i have not checked 0123/0124 to determine the type. |
Related to #973 |
Maybe this is the place to anticipate MRC as well? |
src/qt/transactiontablemodel.cpp
Outdated
{ | ||
return tr("Mined - Interest"); | ||
} | ||
if (wtx->RemoteFlag==1 && false) |
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.
Looks like we can nuke this section since it's not executed.
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.
10-4
fixed mistake and took out remote flag and working to implement the side stake/reward distribution detection. |
So here are some pointers on this from this PR and #1265's point of view... In the normal flow... no splitting, no sidestaking, the CreateCoinStake does... miner.cpp:562 scriptPubKeyKernel = CoinTx.vout[CoinTxN].scriptPubKey; This output is from the stake and is the single stake input to the coinstake transaction. The CBR and the rewards are all merged back onto the single output (besides the empty one). The new SplitCoinStakeOutput function for V10 allows up to 6 destinations for the distribution of rewards, and the remainder (8 - # of distribution outputs - 1 empty) for splitting... Each sidestake distribution can have a different valid address... So what we end up with after all is said and done is... vout[0] empty where n + m <= 7 and m <= 6 and sum(vout[n+1].nValue ... vout[n+m].nValue) <= CBR + RR from CreateGridcoinRewards (because 100% or less of the total CBR + RR can be distributed via sidestaking). Note that vout[1] ... vout[n] the scriptPubKeyKernel guarantees that vout[1].... vout[n] all satisfty IsMine, because they have a key that is from an address that is associated with the staking input from the wallet. Note that vout[n+1]... vout[n+m] the addresses can be...
Note if a sidestake entry that has an address back to self is used, Condition 3 is guaranteed to happen sooner or later, because any mature coins in a wallet address have a chance to stake, hence it is possible and will occur that the coinstake input could have the same address as one of the reward distributions. This is certainly ok... What needs to show up in the wallet UI is the following... what is shown in the staking wallet Which one, Mined - Interest or Mined - POR depends on whether CreateGridcoinRewards just added CBR or also added in some POR too. (That is what we were talking about earlier...) what is shown in the sidestake wallet(s) |
merge conflicts out the butt so i remade this. |
This POR removes the ability to have to use 0123 0124 in stake amount.
Feel Free To NIT and PICK to make this better then its current state.
Made an
enum MinedType
in wallet.h:Reasoning to go beyond POS/POR:
In cases where a block is orphaned the block does not exist anymore so you can't pull the transaction and blockhash it is apart of. we should consider an icon as for now i'm using the ! icon
I've also added UNKNOWN thou I do not think we should run into a case of such, plz comment on that
GenerateType
function added:Looks for the blockhash and if it cannot find it returns
MinedType::ORPHANED
If block is found for the transaction of the coinstake then It will check the Research Subsidy field (which seems like the best bet for this kind of implementation:
If finds 0 subsidy it returns
MinedType::POS
if finds > 0 subsidy it returns
MinedType::POR
Should not find anything less the 0 if so
MinedType::UNKNOWN
this could be in case a bug ever came through that resulted in a negativeResearchReward
. (open to removal)transactiontablemode.cpp:
Changed the detection for the icons based on new implementation
Changes the text shown for the type of mined block based on new implementation
rpcwallet.cpp:
Changes listtransactions to use new implementations
removed:
IsPoR and IsPoR2 functions
Only last part to remove would be the lines from main.cpp:
if (nBoinc > 1) { std::string sTotalSubsidy = RoundToString(CoinToDouble(nTotalSubsidy)+.00000123,8); if (sTotalSubsidy.length() > 7) { sTotalSubsidy = sTotalSubsidy.substr(0,sTotalSubsidy.length()-4) + "0124"; nTotalSubsidy = RoundFromString(sTotalSubsidy,8)*COIN; } }
My changes are not mandatory and backward compatible. the above lines for the final change would likely be mandatory since it is in
GetProofOfStakeReward
so this change is safe to merge till a mandatory that we modify GetProofOfStakeReward with say a block 10 or 11 change for that. this will now not change the last 4 digits of reward once removed as well.I did think about putting this somewhere in wallet however with rebase coming over the next while this would complicate things more i'm sure so it is separated.
This should have a more positive impact on issue #1269 on a cosmetic at this time and we should consider the above code change with the release of cbr and @jamescowens split stake. bonus is we can also now even at ease add even an icon so another wallet receiving a split could show up that icon based on the vouts meaning separate icon for stake split