pub(crate) async fn mpool_pending<DB, KS, B>(
    data: Data<RpcState<DB, KS, B>>,
    Params(params): Params<(CidJsonVec,)>,
) -> Result<Vec<SignedMessage>, JsonRpcError>
where
    DB: BlockStore + Send + Sync + 'static,
    KS: KeyStore + Send + Sync + 'static,
    B: Beacon + Send + Sync + 'static,
{
    let (CidJsonVec(cid_vec),) = params;
    let tsk = TipsetKeys::new(cid_vec);
    let mut ts = data
        .state_manager
        .chain_store()
        .tipset_from_keys(&tsk)
        .await?;

    let (mut pending, mpts) = data.mpool.pending().await?;

    let mut have_cids = HashSet::new();
    for item in pending.iter() {
        have_cids.insert(item.cid()?);
    }

    if mpts.epoch() > ts.epoch() {
        return Ok(pending);
    }

    loop {
        if mpts.epoch() == ts.epoch() {
            if mpts == ts {
                return Ok(pending);
            }

            // mpts has different blocks than ts
            let have = data.mpool.as_ref().messages_for_blocks(ts.blocks()).await?;

            for sm in have {
                have_cids.insert(sm.cid()?);
            }
        }

        let msgs = data.mpool.as_ref().messages_for_blocks(ts.blocks()).await?;

        for m in msgs {
            if have_cids.contains(&m.cid()?) {
                continue;
            }

            have_cids.insert(m.cid()?);
            pending.push(m);
        }

        if mpts.epoch() >= ts.epoch() {
            return Ok(pending);
        }

        ts = data
            .state_manager
            .chain_store()
            .tipset_from_keys(ts.parents())
            .await?;
    }
}
/// Return Vec of pending messages in mpool
Return Vec of pending messages in mpool
Return Vec of pending messages in mpool
pub(crate) async fn mpool_pending<DB, KS, B>(
    data: Data<RpcState<DB, KS, B>>,
    Params(params): Params<(CidJsonVec,)>,
) -> Result<Vec<SignedMessage>, JsonRpcError>
where
    DB: BlockStore + Send + Sync + 'static,
    KS: KeyStore + Send + Sync + 'static,
    B: Beacon + Send + Sync + 'static,
{
    let (CidJsonVec(cid_vec),) = params;
    let tsk = TipsetKeys::new(cid_vec);
    let mut ts = data
        .state_manager
        .chain_store()
        .tipset_from_keys(&tsk)
        .await?;
    let (mut pending, mpts) = data.mpool.pending().await?;
    let mut have_cids = HashSet::new();
    for item in pending.iter() {
        have_cids.insert(item.cid()?);
    }
    if mpts.epoch() > ts.epoch() {
        return Ok(pending);
    }
    loop {
        if mpts.epoch() == ts.epoch() {
            if mpts == ts {
                return Ok(pending);
            }
            // mpts has different blocks than ts
            let have = data.mpool.as_ref().messages_for_blocks(ts.blocks()).await?;
            for sm in have {
                have_cids.insert(sm.cid()?);
            }
        }
        let msgs = data.mpool.as_ref().messages_for_blocks(ts.blocks()).await?;
        for m in msgs {
            if have_cids.contains(&m.cid()?) {
                continue;
            }
            have_cids.insert(m.cid()?);
            pending.push(m);
        }
        if mpts.epoch() >= ts.epoch() {
            return Ok(pending);
        }
        ts = data
            .state_manager
            .chain_store()
            .tipset_from_keys(ts.parents())
            .await?;
    }
}
pub ( crate ) async fn mpool_pending < DB , KS , B > ( data : Data < RpcState < DB , KS , B > > , Params ( params ) : Params < ( CidJsonVec , ) > , ) -> Result < Vec < SignedMessage > , JsonRpcError > where DB : BlockStore + Send + Sync + ' static , KS : KeyStore + Send + Sync + ' static , B : Beacon + Send + Sync + ' static , { let ( CidJsonVec ( cid_vec ) , ) = params ; let tsk = TipsetKeys :: new ( cid_vec ) ; let mut ts = data . state_manager . chain_store ( ) . tipset_from_keys ( & tsk ) . await ? ; let ( mut pending , mpts ) = data . mpool . pending ( ) . await ? ; let mut have_cids = HashSet :: new ( ) ; for item in pending . iter ( ) { have_cids . insert ( item . cid ( ) ? ) ; } if mpts . epoch ( ) > ts . epoch ( ) { return Ok ( pending ) ; } loop { if mpts . epoch ( ) == ts . epoch ( ) { if mpts == ts { return Ok ( pending ) ; } // mpts has different blocks than ts let have = data . mpool . as_ref ( ) . messages_for_blocks ( ts . blocks ( ) ) . await ? ; for sm in have { have_cids . insert ( sm . cid ( ) ? ) ; } } let msgs = data . mpool . as_ref ( ) . messages_for_blocks ( ts . blocks ( ) ) . await ? ; for m in msgs { if have_cids . contains ( & m . cid ( ) ? ) { continue ; } have_cids . insert ( m . cid ( ) ? ) ; pending . push ( m ) ; } if mpts . epoch ( ) >= ts . epoch ( ) { return Ok ( pending ) ; } ts = data . state_manager . chain_store ( ) . tipset_from_keys ( ts . parents ( ) ) . await ? ; } }
Return Vec of pending messages in mpool
Return Vec of pending messages in mpool
data
Params<(CidJsonVec,)>