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
Part 2 of Issue246: Store the validator stake in the database #2457
Conversation
Make separate check and message for Coinbase or already in the tx pool. The documentation was also updated to be correct.
`Fee` is an `Amount` which has an underlying value type of `ulong`, this can be stored as an INTEGER in the `SQLite3` database.
For convenience when the amount that was staked for a validator is needed.
Codecov Report
@@ Coverage Diff @@
## v0.x.x #2457 +/- ##
==========================================
- Coverage 87.23% 87.13% -0.10%
==========================================
Files 154 154
Lines 14779 14770 -9
==========================================
- Hits 12892 12870 -22
- Misses 1887 1900 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
source/agora/consensus/Fee.d
Outdated
@@ -388,7 +388,7 @@ public class FeeManager | |||
|
|||
this.db.execute( | |||
"REPLACE INTO accumulated_fees (fee, public_key) VALUES (?,?)", | |||
this.accumulated_fees[stake.output.address], stake.output.address); | |||
this.accumulated_fees[stake.output.address].tupleof[0], stake.output.address); |
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.
Do you need the tupleof
though ? Since there's a toString
overload it should pick that up.
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.
But it uses INTEGER
SQL type now.
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.
Right, it only uses them for string type.
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.
If not needed for Amount
-> INTEGER
I will remove in next PR.
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.
In fact it is removed already as I had to change the table again to store for each height.
stake = utxo_set_value.output.value; | ||
|
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.
No, isInvalidReason
should not provide the stake to the caller.
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.
The out
parameter is problematic, but I have a commit somewhere that would solve this, so let's move ahead with this.
source/agora/consensus/Fee.d
Outdated
@@ -388,7 +388,7 @@ public class FeeManager | |||
|
|||
this.db.execute( | |||
"REPLACE INTO accumulated_fees (fee, public_key) VALUES (?,?)", | |||
this.accumulated_fees[stake.output.address], stake.output.address); | |||
this.accumulated_fees[stake.output.address].tupleof[0], stake.output.address); |
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.
this.accumulated_fees[stake.output.address].tupleof[0], stake.output.address);
Out of curiosity, what's the meaning of tupleof
in this context?
I only found the meaning for that in this page.
This PR is to prepare some things to facilitate paying out the fees and rewards at the end of the next payment cycle when UTXO set may no longer have our inputs which we need to get the values from.