@@ -25,8 +25,8 @@ pub use clarity::vm::clarity::{ClarityConnection, Error};
25
25
use clarity:: vm:: contexts:: { AssetMap , Environment , OwnedEnvironment } ;
26
26
use clarity:: vm:: costs:: { CostTracker , ExecutionCost , LimitedCostTracker } ;
27
27
use clarity:: vm:: database:: {
28
- BurnStateDB , ClarityDatabase , HeadersDB , RollbackWrapper , RollbackWrapperPersistedLog ,
29
- STXBalance , SqliteConnection , NULL_BURN_STATE_DB , NULL_HEADER_DB ,
28
+ BurnStateDB , ClarityBackingStore , ClarityDatabase , HeadersDB , RollbackWrapper ,
29
+ RollbackWrapperPersistedLog , STXBalance , SqliteConnection , NULL_BURN_STATE_DB , NULL_HEADER_DB ,
30
30
} ;
31
31
use clarity:: vm:: errors:: Error as InterpreterError ;
32
32
use clarity:: vm:: representations:: SymbolicExpression ;
@@ -132,7 +132,7 @@ pub struct ClarityBlockConnection<'a, 'b> {
132
132
/// rollback the transaction by dropping this struct.
133
133
pub struct ClarityTransactionConnection < ' a , ' b > {
134
134
log : Option < RollbackWrapperPersistedLog > ,
135
- store : & ' a mut WritableMarfStore < ' b > ,
135
+ store : & ' b mut dyn ClarityBackingStore ,
136
136
header_db : & ' a dyn HeadersDB ,
137
137
burn_state_db : & ' a dyn BurnStateDB ,
138
138
cost_track : & ' a mut Option < LimitedCostTracker > ,
@@ -141,6 +141,31 @@ pub struct ClarityTransactionConnection<'a, 'b> {
141
141
epoch : StacksEpochId ,
142
142
}
143
143
144
+ impl < ' a , ' b > ClarityTransactionConnection < ' a , ' b > {
145
+ pub fn new (
146
+ store : & ' b mut dyn ClarityBackingStore ,
147
+ header_db : & ' a dyn HeadersDB ,
148
+ burn_state_db : & ' a dyn BurnStateDB ,
149
+ cost_track : & ' a mut Option < LimitedCostTracker > ,
150
+ mainnet : bool ,
151
+ chain_id : u32 ,
152
+ epoch : StacksEpochId ,
153
+ ) -> ClarityTransactionConnection < ' a , ' b > {
154
+ let mut log = RollbackWrapperPersistedLog :: new ( ) ;
155
+ log. nest ( ) ;
156
+ ClarityTransactionConnection {
157
+ log : Some ( log) ,
158
+ store,
159
+ header_db,
160
+ burn_state_db,
161
+ cost_track,
162
+ mainnet,
163
+ chain_id,
164
+ epoch,
165
+ }
166
+ }
167
+ }
168
+
144
169
pub struct ClarityReadOnlyConnection < ' a > {
145
170
datastore : ReadOnlyMarfStore < ' a > ,
146
171
header_db : & ' a dyn HeadersDB ,
@@ -1582,25 +1607,16 @@ impl<'a> ClarityBlockConnection<'a, '_> {
1582
1607
} )
1583
1608
}
1584
1609
1585
- pub fn start_transaction_processing < ' c > ( & ' c mut self ) -> ClarityTransactionConnection < ' c , ' a > {
1586
- let store = & mut self . datastore ;
1587
- let cost_track = & mut self . cost_track ;
1588
- let header_db = self . header_db ;
1589
- let burn_state_db = self . burn_state_db ;
1590
- let mainnet = self . mainnet ;
1591
- let chain_id = self . chain_id ;
1592
- let mut log = RollbackWrapperPersistedLog :: new ( ) ;
1593
- log. nest ( ) ;
1594
- ClarityTransactionConnection {
1595
- store,
1596
- cost_track,
1597
- header_db,
1598
- burn_state_db,
1599
- log : Some ( log) ,
1600
- mainnet,
1601
- chain_id,
1602
- epoch : self . epoch ,
1603
- }
1610
+ pub fn start_transaction_processing ( & mut self ) -> ClarityTransactionConnection {
1611
+ ClarityTransactionConnection :: new (
1612
+ & mut self . datastore ,
1613
+ self . header_db ,
1614
+ self . burn_state_db ,
1615
+ & mut self . cost_track ,
1616
+ self . mainnet ,
1617
+ self . chain_id ,
1618
+ self . epoch ,
1619
+ )
1604
1620
}
1605
1621
1606
1622
/// Execute `todo` as a transaction in this block. The execution
0 commit comments