Skip to content

Commit

Permalink
Merge pull request #39 from KasarLabs/net/manual_import
Browse files Browse the repository at this point in the history
Net/manual import
  • Loading branch information
antiyro authored Oct 7, 2023
2 parents ec4192f + e47db87 commit 497ac8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions crates/client/block-proposer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ where
) -> Self::Proposal {
let (tx, rx) = oneshot::channel();
let spawn_handle = self.spawn_handle.clone();
let txs = self.transaction_pool.ready().count() > 0;

// If there are no transactions, return an error (we want to avoid empty blocks)
if !txs {
return async { Err(sp_blockchain::Error::Application("No transactions in pool".into())) }.boxed();
}

spawn_handle.spawn_blocking(
"madara-block-proposer",
Expand Down
4 changes: 3 additions & 1 deletion crates/client/data-availability/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use lazy_static::lazy_static;
use mp_storage::{
PALLET_STARKNET, STARKNET_CONTRACT_CLASS, STARKNET_CONTRACT_CLASS_HASH, STARKNET_NONCE, STARKNET_STORAGE,
};
use reqwest::{StatusCode, header::{HeaderMap, CONTENT_TYPE}};
use serde_json::json;
use sp_io::hashing::twox_128;
use url::{ParseError, Url};

Expand Down Expand Up @@ -66,4 +68,4 @@ pub fn is_valid_ws_endpoint(endpoint: &str) -> bool {

pub fn is_valid_http_endpoint(endpoint: &str) -> bool {
if let Ok(url) = get_valid_url(endpoint) { matches!(url.scheme(), "http" | "https") } else { false }
}
}

0 comments on commit 497ac8f

Please sign in to comment.