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

Filter transactions from get_account_history result based on block number #61

Closed
vikramrajkumar opened this issue Jan 17, 2017 · 3 comments
Labels

Comments

@vikramrajkumar
Copy link
Contributor

From @theoreticalbts on August 17, 2015 15:4

Negative block number -> relative to head

Copied from original issue: cryptonomex/graphene#236

@vikramrajkumar
Copy link
Contributor Author

From @theoreticalbts on August 18, 2015 16:7

Allowing negative block numbers for relative to head is a bad idea -- the client will likely want to track block numbers on its own.

We need a new index of (account ID, block number) -> operation_history_id where the ohid is the last op by the account in the block. The index should be disabled unless requested on the CLI. Disabling will increase performance but get_account_confirmed_history() will not be able to query based on block number.

@oxarbitrage
Copy link
Member

Can be done easy with the new elastic search plugin.

search in a block range:

curl -X GET 'http://localhost:9200/graphene-*/data/_search?pretty=true' -d '
{
    "query" : {
        "bool" : { "must" : [{"term": { "account_history.account.keyword": "1.2.24484"}},{"term": { "operation_type": 0}}, {"range": {"block_data.block_num": {"gte": 20822908, "lte": 21822908}}}] }
    }
}
'

count:

curl -X GET 'http://localhost:9200/graphene-*/data/_count?pretty=true' -d '
{
    "query" : {
        "bool" : { "must" : [{"term": { "account_history.account.keyword": "1.2.24484"}},{"term": { "operation_type": 0}}, {"range": {"block_data.block_num": {"gte": 20822908, "lte": 21822908}}}] }
    }
}
'

@oxarbitrage
Copy link
Member

closing this one as it can be done by using the commands above in a node with ES plugin. full documentation at https://github.com/bitshares/bitshares-core/wiki/ElasticSearch-Plugin

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

3 participants