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

RocksDBTokensIndex and MemoryTokensIndex with different behavior on the HTR token #1068

Open
msbrogli opened this issue Jun 13, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@msbrogli
Copy link
Member

msbrogli commented Jun 13, 2024

RocksDBTokensIndex._create_genesis_info() takes care of creating token info for the HTR token. This similar method does not exist in MemoryTokensIndex. Maybe we could have a common code in TokenIndexInfo.

Another issue is that both indexes are not indexing the genesis block. So they just work as expected after the first block is mined. Here is a simple test that fails in master (commit 4a46f3a):

Run a full node with no connections. Cmdline: ./hathor-cli run_node --status 8080 --nano-testnet --wallet-index --memory-storage. It fails when using a RocksDB storage too.

❯ curl "http://localhost:8080/v1a/thin_wallet/token?id=00"
{"success":false,"message":"Unknown token"}%
@msbrogli msbrogli changed the title RocksDBTokensIndex and MemoryTokensIndex with different behavior with HTR token RocksDBTokensIndex and MemoryTokensIndex with different behavior on the HTR token Jun 13, 2024
@msbrogli msbrogli added the bug Something isn't working label Jun 13, 2024
@jansegre
Copy link
Member

I see, RocksDBTokensIndex._create_genesis_info() doesn't exist in MemoryTokensIndex because it uses a defaultdict, its purpose is to create the info for the HTR token when first needed. However if the genesis transactions are added to the index, and handled as a token creation (which is how it possibly should be handled), then it will be created and that method will not be needed.

I'll open a fix for this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants