Skip to content
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

Can't find rewards of my delegators #168

Closed
Proxiweb opened this issue Jul 3, 2020 · 6 comments
Closed

Can't find rewards of my delegators #168

Proxiweb opened this issue Jul 3, 2020 · 6 comments

Comments

@Proxiweb
Copy link

Proxiweb commented Jul 3, 2020

In the database, I've found my pool, delegators of my pool but not rewards of delegators ( by addr_id found in the delegation table for my pool )

@erikd
Copy link
Contributor

erikd commented Jul 5, 2020

Please provide the SQL queries you are using.

@Proxiweb
Copy link
Author

Proxiweb commented Jul 5, 2020

select * from pool where hash='\xf784138ce22b62919022ca3439bef0b0d25518da4427bc5beabf4334';
=> 3 pools with the same hash, only the first has delegations

select * from delegation where pool_id = 124;

select * from stake_address left join delegation on stake_address.id=delegation.addr_id where pool_id=124;

=> 5 results
the first one is pool's owner addr_id = 22878;
"581de00115d7c23fd22a60d4306fe148752b41a71256c103465cd2e631c10a"

cardano-cli shelley query stake-address-gives

"581de00115d7c23fd22a60d4306fe148752b41a71256c103465cd2e631c10a": {
    "delegation": "f784138ce22b62919022ca3439bef0b0d25518da4427bc5beabf4334",
    "rewardAccountBalance": 1539770088234
}

select * from reward where addr_id = 22878;
gives nothing

@erikd
Copy link
Contributor

erikd commented Jul 6, 2020

I have a work-in-progress fix in the erikd/pool-fix branch. This splits the pool table into two separate tables pool_hash and pool_update and all other foreign references point to the pool_hash.

Hopefully this makes more sense. Comments welcome.

@erikd
Copy link
Contributor

erikd commented Jul 6, 2020

shelley-test=# select * from pool_hash where hash='\xf784138ce22b62919022ca3439bef0b0d25518da4427bc5beabf4334';
 id  |                            hash                            
-----+------------------------------------------------------------
 105 | \xf784138ce22b62919022ca3439bef0b0d25518da4427bc5beabf4334
(1 row)

shelley-test=# select * from pool_update ;
shelley-test=# select * from pool_update where hash_id = 105 ;
 id  | hash_id |   pledge    | reward_addr_id | meta | margin | fixed_cost | registered_tx_id 
-----+---------+-------------+----------------+------+--------+------------+------------------
 124 |     105 | 90000000000 |          22878 |   82 |   0.05 |  100000000 |             2799
 277 |     105 | 90000000000 |          23200 |   82 |   0.05 |   10000000 |            19285
 298 |     105 | 90000000000 |          23200 |   82 |   0.05 |   10000000 |            27823
(3 rows)

@Proxiweb
Copy link
Author

Proxiweb commented Jul 6, 2020

Its seems good for me, pool updates are easier to understand. Rewards not inserted were related to a wrong pool_id due to pools updates ?

@erikd
Copy link
Contributor

erikd commented Jul 6, 2020

Yes, it seems that was the case.

@erikd erikd added this to the nkis 4ND Minklets milestone Jul 6, 2020
erikd added a commit that referenced this issue Jul 6, 2020
This separation makes it easier to query the rewards earned by delegators.

Closes: #168
Closes: #171
@erikd erikd closed this as completed in 5e81aca Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants