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
7pub struct LogRecorder(RefCell<Vec<(Vec<H256>, Vec<u8>)>>);7pub struct LogRecorder(RefCell<Vec<(Vec<H256>, Vec<u8>)>>);
88
9impl LogRecorder {9impl LogRecorder {
10 pub fn is_empty(&self) -> bool {
11 self.0.borrow().is_empty()
12 }
10 pub fn log(&self, topics: Vec<H256>, data: super::abi::AbiWriter) {13 pub fn log(&self, topics: Vec<H256>, data: super::abi::AbiWriter) {
11 self.0.borrow_mut().push((topics, data.finish()));14 self.0.borrow_mut().push((topics, data.finish()));
12 }15 }
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -2204,6 +2204,9 @@
     }
 
     fn submit_logs(collection: CollectionHandle<T>) -> DispatchResult {
+        if collection.logs.is_empty() {
+            return Ok(())
+        }
         T::EthereumTransactionSender::submit_logs_transaction(
             eth::generate_transaction(collection.id, T::EthereumChainId::get()),
             collection.logs.retrieve_logs_for_contract(eth::collection_id_to_address(collection.id)),