forbole / flowJuno

Creative Commons Zero v1.0 Universal
2 stars 1 forks source link

Get delegator and staker account on x/staking and x/auth is actually the same #4

Closed HarleyAppleChoi closed 2 years ago

HarleyAppleChoi commented 3 years ago

Current Implementation

I did it because there are both implemented on flow-indexer.

x/auth update account every time if an account has a transaction.

x/staking get delegator from address Fetch the account address saved and get their node and delegator info.

Enhancement

To make node_info a single source:

  1. Update corresponding node info and delegator info every time the account has action
  2. account_node table contain account->node_id relation which node_id is the foreign key with staking_table
  3. account_staker table contain account -> node_id , delegator_id which they are the foreign key of delegator_info