Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE

- Add `stackerdb_timeout_secs` to miner config for limiting duration of StackerDB HTTP requests.
- When determining a global transaction replay set, the state evaluator now uses a longest-common-prefix algorithm to find a replay set in the case where a single replay set has less than 70% of signer weight.
- New endpoint /v3/tenures/blocks/ allowing retrieving the list of stacks blocks from a burn block

### Changed

Expand Down
77 changes: 77 additions & 0 deletions docs/rpc/components/examples/tenure-blocks.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"burn_block_hash": "dff0aba3d65209225e365692ac46d26fa64ca9760bd7c244fc27e2022f7cb90d",
"burn_block_height": 51,
"consensus_hash": "90b360130732dd83a165a7fa34386ae547512300",
"stacks_blocks": [
{
"block_hash": "a9f3d8bca7d766a2022528e27c52f39ba77192f0712ea5515cc9d06b97821a11",
"block_id": "67c795896b4c2940b3eb759871661a72e78458ba591dc63979d689d23695891f",
"header_type": "nakamoto",
"height": 116,
"parent_block_id": "fb7102c45bb2f07a6dd86b6672cb39133861fc7d38087e82cb04d4faccfcab82"
},
{
"block_hash": "3e81505acaa3d386e15256921dd1193e479fd9d7f81d993b1c2b327b9bfb05cc",
"block_id": "fb7102c45bb2f07a6dd86b6672cb39133861fc7d38087e82cb04d4faccfcab82",
"header_type": "nakamoto",
"height": 115,
"parent_block_id": "5d51f815bc71508768b71258d8bc2adc68c129428101a418083f5b5ab30d525e"
},
{
"block_hash": "c6f427503dcbe8bf187c7ce523c7a239328b2ab4ec87d6013895b2bd9ed23604",
"block_id": "5d51f815bc71508768b71258d8bc2adc68c129428101a418083f5b5ab30d525e",
"header_type": "nakamoto",
"height": 114,
"parent_block_id": "7d1c89f57a467f888fed171a5b3a2e51a7652f862189710df7db814ef84a29e2"
},
{
"block_hash": "f0665d1dd419e949d68c4e85b7f79e078d6c36d929820b9cd9c794a60c0505b4",
"block_id": "7d1c89f57a467f888fed171a5b3a2e51a7652f862189710df7db814ef84a29e2",
"header_type": "nakamoto",
"height": 113,
"parent_block_id": "b65ab3b6d113285390c1d99c09a62d940f5b55c1cbc10bdc1b478c395fc435f9"
},
{
"block_hash": "0486701e4eed06b74c3d93b82ffc0f3700b3cb2bea41aea1a30e00a5669ec0b7",
"block_id": "b65ab3b6d113285390c1d99c09a62d940f5b55c1cbc10bdc1b478c395fc435f9",
"header_type": "nakamoto",
"height": 112,
"parent_block_id": "c711415e6eedffcb6be16e33eb5c5cf62c3f51047f9528a51e21cbd83b25c185"
},
{
"block_hash": "6724170340a2e507dbe7b21b691412e196c7c8900a597786aa991c1429ae6b58",
"block_id": "c711415e6eedffcb6be16e33eb5c5cf62c3f51047f9528a51e21cbd83b25c185",
"header_type": "nakamoto",
"height": 111,
"parent_block_id": "b11d631ef1b052942973cac88527a56f6e00c51fd57f9b7a710713f58ddc2393"
},
{
"block_hash": "2114066e4446242e558847f552ca839f65ae769ab59000087677007e52b0dab7",
"block_id": "b11d631ef1b052942973cac88527a56f6e00c51fd57f9b7a710713f58ddc2393",
"header_type": "nakamoto",
"height": 110,
"parent_block_id": "2ef1973e95ba622479e59e87251d35c1eaaa9cb7f99f3dd3a8a79359624c38eb"
},
{
"block_hash": "2345d34722cb07e908c5dab7f89ec0756f34d7fe34c86e40881c29c6aa202601",
"block_id": "2ef1973e95ba622479e59e87251d35c1eaaa9cb7f99f3dd3a8a79359624c38eb",
"header_type": "nakamoto",
"height": 109,
"parent_block_id": "9c1f844267819dc7349ff0aff6e6c6f60d8c41b531e304cd89df022ca4d147bf"
},
{
"block_hash": "6b904297fdd045e2d18b93083f9d36592fa6915a53e8461fc3b4c59f6c91bc6d",
"block_id": "9c1f844267819dc7349ff0aff6e6c6f60d8c41b531e304cd89df022ca4d147bf",
"header_type": "nakamoto",
"height": 108,
"parent_block_id": "335596dd153bfc155863a2d439940816cd5095a3b36e2738fb89d715c28ac6c5"
},
{
"block_hash": "cd748c67a9b7e685c52f388cc1d5e334b3dbe2509535caaf9f7ea7b6e5bbad77",
"block_id": "335596dd153bfc155863a2d439940816cd5095a3b36e2738fb89d715c28ac6c5",
"header_type": "nakamoto",
"height": 107,
"parent_block_id": "45cb658a80897117c2cfa6191a7623344ed1079117ad8bb30113019278bac028"
}
]
}
39 changes: 39 additions & 0 deletions docs/rpc/components/schemas/tenure-blocks.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
type: object
properties:
consensus_hash:
type: string
description: Consensus hash of the tenure
pattern: "^[0-9a-f]{40}$"
burn_block_height:
type: integer
description: Height of the Bitcoin block
format: uint64
burn_block_hash:
type: string
description: Hash of the Bitcoin block
pattern: "^[0-9a-f]{64}$"
stacks_blocks:
type: array
items:
type: object
properties:
block_id:
type: string
description: Block ID (index block hash)
pattern: "^[0-9a-f]{64}$"
block_hash:
type: string
description: Hash of the block
pattern: "^[0-9a-f]{64}$"
header_type:
type: string
description: Type of block (currently "epoch2" or "nakamoto")
height:
type: integer
description: Height of the block
format: uint64
parent_block_id:
type: string
description: Block ID (index block hash) of the parent
pattern: "^[0-9a-f]{64}$"

36 changes: 36 additions & 0 deletions docs/rpc/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ components:
$ref: ./components/schemas/tenure-tip.schema.yaml
GetStackerSet:
$ref: ./components/schemas/get-stacker-set.schema.yaml
TenureBlocks:
$ref: ./components/schemas/tenure-blocks.schema.yaml

paths:
/v2/transactions:
Expand Down Expand Up @@ -1057,6 +1059,40 @@ paths:
type: string
format: binary

/v3/tenures/blocks/{consensus_hash}:
get:
summary: Get the list of Stacks blocks in a tenure
tags:
- Blocks
security: []
operationId: getTenureBlocks
description: |
Get the list of blocks in a tenure. The blocks will be
shown in order from highest to lowest.
parameters:
- name: consensus_hash
in: path
description: The hex-encoded consensus hash of the tenure to query (40 hexadecimal characters, without 0x prefix)
required: true
schema:
type: string
pattern: "^[0-9a-f]{40}$"
responses:
"200":
description: List of Stacks blocks in the tenure
content:
application/json:
schema:
$ref: "#/components/schemas/TenureBlocks"
example:
$ref: "./components/examples/tenure-blocks.example.json"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalServerError"

/v3/sortitions:
get:
summary: Get latest sortition information
Expand Down
7 changes: 7 additions & 0 deletions stackslib/src/chainstate/stacks/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@ impl StacksHeaderInfo {
pub fn is_nakamoto_block(&self) -> bool {
matches!(self.anchored_header, StacksBlockHeaderTypes::Nakamoto(_))
}

pub fn header_type_name(&self) -> &str {
match self.anchored_header {
StacksBlockHeaderTypes::Epoch2(_) => "epoch2",
StacksBlockHeaderTypes::Nakamoto(_) => "nakamoto",
}
}
}

impl FromRow<DBConfig> for DBConfig {
Expand Down
Loading