git.delta.rocks / unique-network / refs/commits / 41df7418f56b

difftreelog

perf do not submit eth transactions with no logs

Yaroslav Bolyukin2021-05-04parent: #7994dd0.patch.diff
in: master

2 files changed

modifiedpallets/nft/src/eth/log.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/log.rs
+++ b/pallets/nft/src/eth/log.rs
@@ -7,6 +7,9 @@
 pub struct LogRecorder(RefCell<Vec<(Vec<H256>, Vec<u8>)>>);
 
 impl LogRecorder {
+    pub fn is_empty(&self) -> bool {
+        self.0.borrow().is_empty()
+    }
     pub fn log(&self, topics: Vec<H256>, data: super::abi::AbiWriter) {
         self.0.borrow_mut().push((topics, data.finish()));
     }
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
2204 }2204 }
22052205
2206 fn submit_logs(collection: CollectionHandle<T>) -> DispatchResult {2206 fn submit_logs(collection: CollectionHandle<T>) -> DispatchResult {
2207 if collection.logs.is_empty() {
2208 return Ok(())
2209 }
2207 T::EthereumTransactionSender::submit_logs_transaction(2210 T::EthereumTransactionSender::submit_logs_transaction(
2208 eth::generate_transaction(collection.id, T::EthereumChainId::get()),2211 eth::generate_transaction(collection.id, T::EthereumChainId::get()),
2209 collection.logs.retrieve_logs_for_contract(eth::collection_id_to_address(collection.id)),2212 collection.logs.retrieve_logs_for_contract(eth::collection_id_to_address(collection.id)),