@@ -88,10 +88,17 @@ pub struct NewBurnBlock {
88
88
pub consensus_hash : ConsensusHash ,
89
89
}
90
90
91
- /// Scope of Tx Replay in terms of Burn block boundaries
92
- /// - tuple.0 is the fork originating the tx replay,
93
- /// - tuple.1 is the canonical burnchain tip when Tx Replay begun
94
- pub type TxReplayScopeOpt = Option < ( NewBurnBlock , NewBurnBlock ) > ;
91
+ /// Represents the scope of Tx Replay in terms of burn block boundaries.
92
+ #[ derive( Debug ) ]
93
+ pub struct TxReplayScope {
94
+ /// The burn block where the fork that originated the transaction replay began.
95
+ pub fork_origin : NewBurnBlock ,
96
+ /// The canonical burn chain tip at the time the transaction replay started.
97
+ pub past_tip : NewBurnBlock ,
98
+ }
99
+
100
+ /// Optional `TxReplayScope`, representing the potential absence of a replay scope.
101
+ pub type TxReplayScopeOpt = Option < TxReplayScope > ;
95
102
96
103
impl LocalStateMachine {
97
104
/// Initialize a local state machine by querying the local stacks-node
@@ -936,7 +943,7 @@ impl LocalStateMachine {
936
943
"prior_state_machine.burn_block" => %prior_state_machine. burn_block,
937
944
) ;
938
945
939
- let ( fork_origin , past_tip ) = match tx_replay_scope {
946
+ let scope = match tx_replay_scope {
940
947
Some ( scope) => scope,
941
948
None => {
942
949
warn ! ( "Tx Replay: BUG! Scope cannot be None while in replay mode!" ) ;
@@ -945,7 +952,7 @@ impl LocalStateMachine {
945
952
} ;
946
953
947
954
let is_deepest_fork =
948
- expected_burn_block. burn_block_height < fork_origin. burn_block_height ;
955
+ expected_burn_block. burn_block_height < scope . fork_origin . burn_block_height ;
949
956
if !is_deepest_fork {
950
957
//if it is within the scope or after - this is not a new fork, but the continue of a reorg
951
958
info ! ( "Tx Replay: nothing todo. Reorg in progress!" ) ;
@@ -958,9 +965,12 @@ impl LocalStateMachine {
958
965
db,
959
966
client,
960
967
expected_burn_block,
961
- past_tip,
968
+ & scope . past_tip ,
962
969
) ? {
963
- let scope = ( expected_burn_block. clone ( ) , past_tip. clone ( ) ) ;
970
+ let scope = TxReplayScope {
971
+ fork_origin : expected_burn_block. clone ( ) ,
972
+ past_tip : scope. past_tip . clone ( ) ,
973
+ } ;
964
974
965
975
info ! ( "Tx Replay: replay set updated with {} tx(s)" , replay_set. len( ) ;
966
976
"tx_replay_set" => ?replay_set,
@@ -1010,7 +1020,10 @@ impl LocalStateMachine {
1010
1020
}
1011
1021
Some ( replay_set) => {
1012
1022
let scope_opt = if !replay_set. is_empty ( ) {
1013
- let scope = ( expected_burn_block. clone ( ) , potential_replay_tip) ;
1023
+ let scope = TxReplayScope {
1024
+ fork_origin : expected_burn_block. clone ( ) ,
1025
+ past_tip : potential_replay_tip,
1026
+ } ;
1014
1027
info ! ( "Tx Replay: replay set updated with {} tx(s)" , replay_set. len( ) ;
1015
1028
"tx_replay_set" => ?replay_set,
1016
1029
"tx_replay_scope" => ?scope) ;
0 commit comments