Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/message_pool/msgpool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ pub mod tests {

assert_eq!(mpool.get_sequence(&sender).unwrap(), 4);

let (p, _) = mpool.pending().unwrap();
let (p, _) = mpool.pending();
assert_eq!(p.len(), 3);
}

Expand Down
21 changes: 11 additions & 10 deletions src/message_pool/msgpool/msg_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,21 +586,22 @@ where

/// Return a tuple that contains a vector of all signed messages and the
/// current tipset for self.
pub fn pending(&self) -> Result<(Vec<SignedMessage>, Tipset), Error> {
let mut out: Vec<SignedMessage> = Vec::new();
pub fn pending(&self) -> (Vec<SignedMessage>, Tipset) {
let pending = self.pending.read().clone();

for (addr, _) in pending {
out.append(
self.pending_for(&addr)
.ok_or(Error::InvalidFromAddr)?
.as_mut(),
)
let len = pending.values().map(|mset| mset.msgs.len()).sum();
let mut out = Vec::with_capacity(len);

for mset in pending.into_values() {
out.extend(
Comment thread
sudo-shashank marked this conversation as resolved.
mset.msgs
.into_values()
.sorted_unstable_by_key(|m| m.message().sequence),
);
}

let cur_ts = self.current_tipset();

Ok((out, cur_ts))
(out, cur_ts)
}

/// Return a Vector of signed messages for a given from address. This vector
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,7 @@ async fn get_eth_transaction_by_hash(
}

// If not found, try to get it from the mempool
let (pending, _) = ctx.mpool.pending()?;
let (pending, _) = ctx.mpool.pending();

if let Some(smsg) = pending.iter().find(|item| item.cid() == message_cid) {
// We only return pending eth-account messages because we can't guarantee
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/methods/mpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl RpcMethod<1> for MpoolPending {
.chain_store()
.load_required_tipset_or_heaviest(&tipset_key)?;

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

let mut have_cids = HashSet::new();
for item in pending.iter() {
Expand Down
Loading