Add get_tera_shares() to schema #403

Merged
parabitdev merged 3 commits from parabit/tshare-helper-funciton into master 2026-02-03 22:08:01 +00:00
parabitdev commented 2026-02-02 16:21:22 +00:00 (Migrated from github.com)

Returns the number of shares with a difficulty greater than 1T. Function already exists so no dedicated migration/deployment is required after merge.

In Rust terms the function is

fn get_tera_shares(
    min_blockheight: Option<i32>,
    max_blockheight: Option<i32>,
) -> Vec<(String, i64)>

Unlike in rust we can just exclude values if they are None, so this can be called over:
The whole range of shares: SELECT * FROM get_tera_shares();
Shares since a specified height: SELECT * FROM get_tera_shares(930377);
Shares between two specified heights: SELECT * FROM get_tera_shares(930377, 930900);

min_blockheight is inclusive and max_blockheight is exclusive.

Returns the number of shares with a difficulty greater than 1T. Function already exists so no dedicated migration/deployment is required after merge. In Rust terms the function is ```rust fn get_tera_shares( min_blockheight: Option<i32>, max_blockheight: Option<i32>, ) -> Vec<(String, i64)> ``` Unlike in rust we can just exclude values if they are None, so this can be called over: The whole range of shares: `SELECT * FROM get_tera_shares();` Shares since a specified height: `SELECT * FROM get_tera_shares(930377);` Shares between two specified heights: `SELECT * FROM get_tera_shares(930377, 930900);` min_blockheight is inclusive and max_blockheight is exclusive.
parabitdev commented 2026-02-02 17:39:43 +00:00 (Migrated from github.com)

Yes, we absolutely can! I hadn't even considered doing so as this was just an adhoc query I was running. Good change request!

Yes, we absolutely can! I hadn't even considered doing so as this was just an adhoc query I was running. Good change request!
Sign in to join this conversation.
No description provided.