File tree Expand file tree Collapse file tree 4 files changed +8
-16
lines changed Expand file tree Collapse file tree 4 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ impl GlobalStateEvaluator {
136
136
burn_block,
137
137
burn_block_height,
138
138
current_miner,
139
- ReplayTransactionSet :: new ( vec ! [ ] ) ,
139
+ ReplayTransactionSet :: none ( ) ,
140
140
) ,
141
141
StateMachineUpdateContent :: V1 {
142
142
burn_block,
@@ -207,16 +207,8 @@ impl ReplayTransactionSet {
207
207
self . 0 . is_empty ( )
208
208
}
209
209
210
- /// Unwrap the `ReplayTransactionSet`. Panics if the set is empty.
211
- pub fn unwrap ( self ) -> Vec < StacksTransaction > {
212
- if self . is_empty ( ) {
213
- panic ! ( "Called `unwrap` on an empty `ReplayTransactionSet`" ) ;
214
- }
215
- self . 0
216
- }
217
-
218
210
/// Map into an optional, returning `None` if the set is empty
219
- pub fn into_optional ( & self ) -> Option < Vec < StacksTransaction > > {
211
+ pub fn clone_as_optional ( & self ) -> Option < Vec < StacksTransaction > > {
220
212
if self . is_empty ( ) {
221
213
None
222
214
} else {
@@ -229,7 +221,7 @@ impl ReplayTransactionSet {
229
221
if self . is_empty ( ) {
230
222
vec ! [ ]
231
223
} else {
232
- self . unwrap ( )
224
+ self . 0
233
225
}
234
226
}
235
227
Original file line number Diff line number Diff line change @@ -1641,7 +1641,7 @@ impl Signer {
1641
1641
self . global_state_evaluator
1642
1642
. get_global_tx_replay_set ( )
1643
1643
. unwrap_or_default ( )
1644
- . into_optional ( )
1644
+ . clone_as_optional ( )
1645
1645
} else {
1646
1646
None
1647
1647
} ,
Original file line number Diff line number Diff line change @@ -384,7 +384,7 @@ impl LocalStateMachine {
384
384
} ;
385
385
386
386
if let Some ( replay_set_hash) = NakamotoBlockProposal :: tx_replay_hash (
387
- & prior_state_machine. tx_replay_set . into_optional ( ) ,
387
+ & prior_state_machine. tx_replay_set . clone_as_optional ( ) ,
388
388
) {
389
389
match db. get_was_block_validated_by_replay_tx ( signer_signature_hash, replay_set_hash) {
390
390
Ok ( Some ( BlockValidatedByReplaySet {
@@ -674,7 +674,7 @@ impl LocalStateMachine {
674
674
burn_block_height : * burn_block_height,
675
675
current_miner : current_miner. into ( ) ,
676
676
active_signer_protocol_version,
677
- tx_replay_set : tx_replay_set . clone ( ) ,
677
+ tx_replay_set,
678
678
} ) ;
679
679
// Because we updated our active signer protocol version, update local_update so its included in the subsequent evaluations
680
680
let Ok ( update) =
@@ -877,7 +877,7 @@ impl LocalStateMachine {
877
877
let Self :: Initialized ( state) = self else {
878
878
return None ;
879
879
} ;
880
- state. tx_replay_set . into_optional ( )
880
+ state. tx_replay_set . clone_as_optional ( )
881
881
}
882
882
883
883
/// Handle a possible bitcoin fork. If a fork is detetected,
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ pub struct BlockValidateOk {
176
176
pub size : u64 ,
177
177
pub validation_time_ms : u64 ,
178
178
/// If a block was validated by a transaction replay set,
179
- /// then this return Some with the hash of the replay set.
179
+ /// then this returns ` Some` with the hash of the replay set.
180
180
pub replay_tx_hash : Option < u64 > ,
181
181
/// If a block was validated by a transaction replay set,
182
182
/// then this is true if this block exhausted the set of transactions.
You can’t perform that action at this time.
0 commit comments