16
16
use std:: io:: { Read , Seek , SeekFrom , Write } ;
17
17
use std:: { fs, io} ;
18
18
19
+ use clarity:: types:: chainstate:: VRFSeed ;
19
20
use regex:: { Captures , Regex } ;
20
21
use serde:: de:: Error as de_Error;
22
+ use serde:: Serialize ;
21
23
use stacks_common:: codec:: { StacksMessageCodec , MAX_MESSAGE_LEN } ;
22
24
use stacks_common:: types:: chainstate:: {
23
25
BlockHeaderHash , BurnchainHeaderHash , ConsensusHash , SortitionId , StacksBlockId ,
@@ -111,6 +113,9 @@ pub struct SortitionInfo {
111
113
/// In Stacks 2.x, this is the winning block.
112
114
/// In Stacks 3.x, this is the first block of the parent tenure.
113
115
pub committed_block_hash : Option < BlockHeaderHash > ,
116
+ #[ serde( with = "prefix_opt_hex" ) ]
117
+ /// doc
118
+ pub vrf_seed : Option < VRFSeed > ,
114
119
}
115
120
116
121
impl TryFrom < ( & str , & str ) > for QuerySpecifier {
@@ -163,12 +168,12 @@ impl GetSortitionHandler {
163
168
let is_shadow = chainstate
164
169
. nakamoto_blocks_db ( )
165
170
. is_shadow_tenure ( & sortition_sn. consensus_hash ) ?;
166
- let ( miner_pk_hash160, stacks_parent_ch, committed_block_hash, last_sortition_ch) =
171
+ let ( miner_pk_hash160, stacks_parent_ch, committed_block_hash, last_sortition_ch, vrf_seed ) =
167
172
if !sortition_sn. sortition && !is_shadow {
168
173
let handle = sortdb. index_handle ( & sortition_sn. sortition_id ) ;
169
174
let last_sortition =
170
175
handle. get_last_snapshot_with_sortition ( sortition_sn. block_height ) ?;
171
- ( None , None , None , Some ( last_sortition. consensus_hash ) )
176
+ ( None , None , None , Some ( last_sortition. consensus_hash ) , None )
172
177
} else if !sortition_sn. sortition && is_shadow {
173
178
// this is a shadow tenure.
174
179
let parent_tenure_ch = chainstate
@@ -191,6 +196,7 @@ impl GetSortitionHandler {
191
196
parent_tenure_start_header. index_block_hash ( ) . 0 ,
192
197
) ) ,
193
198
Some ( parent_tenure_ch) ,
199
+ None ,
194
200
)
195
201
} else {
196
202
let block_commit = SortitionDB :: get_block_commit ( sortdb. conn ( ) , & sortition_sn. winning_block_txid , & sortition_sn. sortition_id ) ?
@@ -236,6 +242,7 @@ impl GetSortitionHandler {
236
242
Some ( stacks_parent_sn. consensus_hash ) ,
237
243
Some ( block_commit. block_header_hash ) ,
238
244
Some ( last_sortition_ch) ,
245
+ Some ( block_commit. new_seed ) ,
239
246
)
240
247
} ;
241
248
@@ -251,6 +258,7 @@ impl GetSortitionHandler {
251
258
stacks_parent_ch,
252
259
last_sortition_ch,
253
260
committed_block_hash,
261
+ vrf_seed,
254
262
} )
255
263
}
256
264
}
0 commit comments