(mut self)
| 171 | } |
| 172 | |
| 173 | pub fn commit(mut self) -> Result<B256, TransactionError> { |
| 174 | let mut changes = self.pending_changes.drain().collect::<Vec<_>>(); |
| 175 | if !changes.is_empty() { |
| 176 | self.database.storage_engine.set_values(&mut self.context, changes.as_mut()).unwrap(); |
| 177 | } |
| 178 | |
| 179 | let mut transaction_manager = self.database.transaction_manager.lock(); |
| 180 | self.database.storage_engine.commit(&self.context).unwrap(); |
| 181 | |
| 182 | self.database.update_metrics_rw(&self.context); |
| 183 | |
| 184 | transaction_manager.remove_tx(self.context.snapshot_id, true); |
| 185 | |
| 186 | self.committed = true; |
| 187 | Ok(self.context.root_node_hash) |
| 188 | } |
| 189 | |
| 190 | pub fn rollback(mut self) -> Result<(), TransactionError> { |
| 191 | let mut transaction_manager = self.database.transaction_manager.lock(); |
nothing calls this directly
no test coverage detected