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

Add feerate_percentiles to blockinfo endpoint #3753

Merged
merged 16 commits into from
May 24, 2024
Merged
4 changes: 4 additions & 0 deletions docs/src/inscriptions/recursion.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ Examples

- `/r/blockinfo/0`:

Note: `feerate_percentiles` are feerates at the 10th, 25th, 50th, 75th, and 90th
percentile in sats/vB.

```json
{
"average_fee": 0,
Expand All @@ -87,6 +90,7 @@ Examples
"confirmations": 0,
"difficulty": 0.0,
"hash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
"feerate_percentiles": [0, 0, 0, 0, 0],
benbuschmann marked this conversation as resolved.
Show resolved Hide resolved
"height": 0,
"max_fee": 0,
"max_fee_rate": 0,
Expand Down
1 change: 1 addition & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub struct BlockInfo {
pub confirmations: i32,
pub difficulty: f64,
pub hash: BlockHash,
pub feerate_percentiles: [u64; 5],
pub height: u32,
pub max_fee: u64,
pub max_fee_rate: u64,
Expand Down
9 changes: 9 additions & 0 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,13 @@ impl Server {
confirmations: info.confirmations,
difficulty: info.difficulty,
hash,
feerate_percentiles: [
stats.fee_rate_percentiles.fr_10th.to_sat(),
stats.fee_rate_percentiles.fr_25th.to_sat(),
stats.fee_rate_percentiles.fr_50th.to_sat(),
stats.fee_rate_percentiles.fr_75th.to_sat(),
stats.fee_rate_percentiles.fr_90th.to_sat(),
],
height: info.height.try_into().unwrap(),
max_fee: stats.max_fee.to_sat(),
max_fee_rate: stats.max_fee_rate.to_sat(),
Expand Down Expand Up @@ -6421,6 +6428,7 @@ next
hash: "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
.parse()
.unwrap(),
feerate_percentiles: [0, 0, 0, 0, 0],
height: 0,
max_fee: 0,
max_fee_rate: 0,
Expand Down Expand Up @@ -6460,6 +6468,7 @@ next
hash: "56d05060a0280d0712d113f25321158747310ece87ea9e299bde06cf385b8d85"
.parse()
.unwrap(),
feerate_percentiles: [0, 0, 0, 0, 0],
height: 1,
max_fee: 0,
max_fee_rate: 0,
Expand Down
Loading