async fn add_helper<T>(
    api: &RwLock<T>,
    bls_sig_cache: &RwLock<LruCache<Cid, Signature>>,
    pending: &RwLock<HashMap<Address, MsgSet>>,
    msg: SignedMessage,
    sequence: u64,
) -> Result<(), Error>
where
    T: Provider,
{
    if msg.signature().signature_type() == SignatureType::BLS {
        bls_sig_cache
            .write()
            .await
            .put(msg.cid()?, msg.signature().clone());
    }

    if msg.message().gas_limit() > 100_000_000 {
        return Err(Error::Other(
            "given message has too high of a gas limit".to_string(),
        ));
    }

    api.read()
        .await
        .put_message(&ChainMessage::Signed(msg.clone()))?;
    api.read()
        .await
        .put_message(&ChainMessage::Unsigned(msg.message().clone()))?;

    let mut pending = pending.write().await;
    let msett = pending.get_mut(msg.message().from());
    match msett {
        Some(mset) => mset.add(msg)?,
        None => {
            let mut mset = MsgSet::new(sequence);
            let from = *msg.message().from();
            mset.add(msg)?;
            pending.insert(from, mset);
        }
    }

    Ok(())
}
/// Finish verifying signed message before adding it to the pending mset hashmap. If an entry
/// in the hashmap does not yet exist, create a new mset that will correspond to the from message
/// and push it to the pending hashmap
Finish verifying signed message before adding it to the pending mset hashmap. If an entry
in the hashmap does not yet exist, create a new mset that will correspond to the from message
and push it to the pending hashmap
Finish verifying signed message before adding it to the pending mset hashmap . If an entry in the hashmap does not yet exist create a new mset that will correspond to the from message and push it to the pending hashmap
async fn add_helper<T>(
    api: &RwLock<T>,
    bls_sig_cache: &RwLock<LruCache<Cid, Signature>>,
    pending: &RwLock<HashMap<Address, MsgSet>>,
    msg: SignedMessage,
    sequence: u64,
) -> Result<(), Error>
where
    T: Provider,
{
    if msg.signature().signature_type() == SignatureType::BLS {
        bls_sig_cache
            .write()
            .await
            .put(msg.cid()?, msg.signature().clone());
    }
    if msg.message().gas_limit() > 100_000_000 {
        return Err(Error::Other(
            "given message has too high of a gas limit".to_string(),
        ));
    }
    api.read()
        .await
        .put_message(&ChainMessage::Signed(msg.clone()))?;
    api.read()
        .await
        .put_message(&ChainMessage::Unsigned(msg.message().clone()))?;
    let mut pending = pending.write().await;
    let msett = pending.get_mut(msg.message().from());
    match msett {
        Some(mset) => mset.add(msg)?,
        None => {
            let mut mset = MsgSet::new(sequence);
            let from = *msg.message().from();
            mset.add(msg)?;
            pending.insert(from, mset);
        }
    }
    Ok(())
}
async fn add_helper < T > ( api : & RwLock < T > , bls_sig_cache : & RwLock < LruCache < Cid , Signature > > , pending : & RwLock < HashMap < Address , MsgSet > > , msg : SignedMessage , sequence : u64 , ) -> Result < ( ) , Error > where T : Provider , { if msg . signature ( ) . signature_type ( ) == SignatureType :: BLS { bls_sig_cache . write ( ) . await . put ( msg . cid ( ) ? , msg . signature ( ) . clone ( ) ) ; } if msg . message ( ) . gas_limit ( ) > 100_000_000 { return Err ( Error :: Other ( " " . to_string ( ) , ) ) ; } api . read ( ) . await . put_message ( & ChainMessage :: Signed ( msg . clone ( ) ) ) ? ; api . read ( ) . await . put_message ( & ChainMessage :: Unsigned ( msg . message ( ) . clone ( ) ) ) ? ; let mut pending = pending . write ( ) . await ; let msett = pending . get_mut ( msg . message ( ) . from ( ) ) ; match msett { Some ( mset ) => mset . add ( msg ) ? , None => { let mut mset = MsgSet :: new ( sequence ) ; let from = * msg . message ( ) . from ( ) ; mset . add ( msg ) ? ; pending . insert ( from , mset ) ; } } Ok ( ( ) ) }
Finish verifying signed message before adding it to the pending mset hashmap.
Finish verifying signed message before adding it to the pending mset hashmap .
api
&RwLock<T>
bls_sig_cache
&RwLock<LruCache<Cid, Signature>>
pending
&RwLock<HashMap<Address, MsgSet>>
msg
SignedMessage
sequence
u64