|
|
## Block processing
|
|
|
hafbe will process blocks in a loop and write data from hived node to own tables. The processing is divided by light and heavy tables
|
|
|
### Light: Block witnesses and voters id's
|
|
|
---
|
|
|
`block_witness`
|
|
|
Data from blocks in haf database will be gathered in sink process to `hafbe_app` schema tables.
|
|
|
### witness_votes
|
|
|
```
|
|
|
block_num | witness_id | witness_hash | signing_key
|
|
|
witness_id | voter_id
|
|
|
INT | INT
|
|
|
```
|
|
|
- `witness_id` - from [condenser_api.get_witness_by_account](https://developers.hive.io/apidefinitions/#condenser_api.get_witness_by_account)
|
|
|
- `witness_hash` - generated during processing
|
|
|
- `signing_key` - from [block_api.get_block](https://developers.hive.io/apidefinitions/#block_api.get_block) where also `witness` is passed to `condenser_api` to get `witness_id`.
|
|
|
---
|
|
|
`votes`
|
|
|
`id` will be taken from `hive.accounts_view`, data gathered from `account_witness_vote_operation`
|
|
|
### witness_voters
|
|
|
``` |
|
|
\ No newline at end of file |
|
|
vote_id | voter_id | voter_hash | witness_id
|
|
|
```
|
|
|
- `vote_id` - from [database_api.list_witness_votes](https://developers.hive.io/apidefinitions/#database_api.list_witness_votes)
|
|
|
- `voter_id` - from [condenser_api.get_witness_by_account](https://developers.hive.io/apidefinitions/#condenser_api.get_accounts)
|
|
|
- `voter_hash` - generated during processing
|
|
|
|
|
|
### Heavy: Account data of witnessess and voters
|
|
|
---
|
|
|
`accounts`
|
|
|
```
|
|
|
account_hash | name | ... other account data from hived
|
|
|
```
|
|
|
- Voter name and other `name`'s from `hive.accounts_view` by `block_num` are parameters for [condenser_api.get_accounts](https://developers.hive.io/apidefinitions/#condenser_api.get_accounts) call.
|
|
|
- `account_hash` is either `witness_hash` or `voter_hash`
|
|
|
|
|
|
## Notes
|
|
|
- All `id`'s are taken from hived node;
|
|
|
- Only `get_top_witnesses` method will remain which calls `condenser_api`, other methods will call hafbe sql tables;
|
|
|
- Because an account can be a witness and a voter, both categories are written to `accounts`, hashes are used to avoid duplicate id's |
|
|
\ No newline at end of file |