@@ -35,6 +35,7 @@ use libsigner::v0::messages::{
35
35
use libsigner:: v0:: signer_state:: MinerState ;
36
36
use libsigner:: { BlockProposal , SignerEntries , SignerEventTrait } ;
37
37
use serde:: { Deserialize , Serialize } ;
38
+ use stacks:: burnchains:: Txid ;
38
39
use stacks:: chainstate:: coordinator:: comm:: CoordinatorChannels ;
39
40
use stacks:: chainstate:: nakamoto:: signer_set:: NakamotoSigners ;
40
41
use stacks:: chainstate:: nakamoto:: NakamotoBlock ;
@@ -239,6 +240,9 @@ impl<Z: SpawnedSignerTrait> SignerTest<Z> {
239
240
let ( mut naka_conf, _miner_account) =
240
241
naka_neon_integration_conf ( snapshot_name. map ( |n| n. as_bytes ( ) ) ) ;
241
242
243
+ naka_conf. miner . activated_vrf_key_path =
244
+ Some ( format ! ( "{}/vrf_key" , naka_conf. node. working_dir) ) ;
245
+
242
246
node_config_modifier ( & mut naka_conf) ;
243
247
244
248
// Add initial balances to the config
@@ -365,7 +369,11 @@ impl<Z: SpawnedSignerTrait> SignerTest<Z> {
365
369
let metadata_path = snapshot_path. join ( "metadata.json" ) ;
366
370
if !metadata_path. clone ( ) . exists ( ) {
367
371
warn ! ( "Snapshot metadata file does not exist, not restoring snapshot" ) ;
368
- return SetupSnapshotResult :: NoSnapshot ;
372
+ std:: fs:: remove_dir_all ( snapshot_path. clone ( ) ) . unwrap ( ) ;
373
+ return SetupSnapshotResult :: WithSnapshot ( SnapshotSetupInfo {
374
+ snapshot_path : snapshot_path. clone ( ) ,
375
+ snapshot_exists : false ,
376
+ } ) ;
369
377
}
370
378
let Ok ( metadata) = serde_json:: from_reader :: < _ , SnapshotMetadata > (
371
379
File :: open ( metadata_path. clone ( ) ) . unwrap ( ) ,
@@ -1067,6 +1075,20 @@ impl<Z: SpawnedSignerTrait> SignerTest<Z> {
1067
1075
} )
1068
1076
}
1069
1077
1078
+ pub fn wait_for_replay_set_eq ( & self , timeout : u64 , expected_txids : Vec < String > ) {
1079
+ self . wait_for_signer_state_check ( timeout, |state| {
1080
+ let Some ( replay_set) = state. get_tx_replay_set ( ) else {
1081
+ return Ok ( false ) ;
1082
+ } ;
1083
+ let txids = replay_set
1084
+ . iter ( )
1085
+ . map ( |tx| tx. txid ( ) . to_hex ( ) )
1086
+ . collect :: < Vec < _ > > ( ) ;
1087
+ Ok ( txids == expected_txids)
1088
+ } )
1089
+ . expect ( "Timed out waiting for replay set to be equal to expected txids" ) ;
1090
+ }
1091
+
1070
1092
/// Replace the test's configured signer st
1071
1093
pub fn replace_signers (
1072
1094
& mut self ,
@@ -1585,6 +1607,31 @@ impl<Z: SpawnedSignerTrait> SignerTest<Z> {
1585
1607
. send_message_with_retry :: < SignerMessage > ( accepted. into ( ) )
1586
1608
. expect ( "Failed to send accept signature" ) ;
1587
1609
}
1610
+
1611
+ /// Get the txid of the parent block commit transaction for the given miner
1612
+ pub fn get_parent_block_commit_txid ( & self , miner_pk : & StacksPublicKey ) -> Option < Txid > {
1613
+ let Some ( confirmed_utxo) = self
1614
+ . running_nodes
1615
+ . btc_regtest_controller
1616
+ . get_all_utxos ( & miner_pk)
1617
+ . into_iter ( )
1618
+ . find ( |utxo| utxo. confirmations == 0 )
1619
+ else {
1620
+ return None ;
1621
+ } ;
1622
+ let unconfirmed_txid = Txid :: from_bitcoin_tx_hash ( & confirmed_utxo. txid ) ;
1623
+ let unconfirmed_tx = self
1624
+ . running_nodes
1625
+ . btc_regtest_controller
1626
+ . get_raw_transaction ( & unconfirmed_txid) ;
1627
+ let parent_txid = unconfirmed_tx
1628
+ . input
1629
+ . get ( 0 )
1630
+ . expect ( "First input should exist" )
1631
+ . previous_output
1632
+ . txid ;
1633
+ Some ( Txid :: from_bitcoin_tx_hash ( & parent_txid) )
1634
+ }
1588
1635
}
1589
1636
1590
1637
fn setup_stx_btc_node < G : FnMut ( & mut NeonConfig ) > (
0 commit comments