Modify ScabbardState commit
Modify the `ScabbardState` commit method to write transaction receipts
to the LMDB backed transaction_receipt_store if "diesel-receipt-store"
is not enabled and write transaction receipts to the experimental diesel
backed receipt_store if "diesel-receipt-store" is enabled.
@@ -373,6 +373,7 @@ impl ScabbardState {
.map(StateChangeEvent::try_from)
.collect::<Result<Vec<_>, _>>()?;
+ #[cfg(not(feature = "diesel-receipt-store"))]
self.transaction_receipt_store
.write()
.map_err(|err| {
@@ -389,6 +390,23 @@ impl ScabbardState {
))
})?;
+ #[cfg(feature = "diesel-receipt-store")]
+ self.receipt_store
+ .write()
+ .map_err(|err| {
+ ScabbardStateError(format!(
+ "transaction receipt store lock poisoned: {}",
+ err
+ ))
+ })?
+ .add_txn_receipts(txn_receipts)
+ .map_err(|err| {
+ ScabbardStateError(format!(
+ "failed to add transaction receipts to store: {}",
+ err
+ ))
+ })?;
+
for event in events {
self.event_subscribers.retain(|subscriber| {
match subscriber.handle_event(event.clone()) {
