mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 22:37:57 +00:00
prospective-parachains: respond with multiple backable candidates (#3160)
Fixes https://github.com/paritytech/polkadot-sdk/issues/3129
This commit is contained in:
@@ -806,15 +806,18 @@ async fn get_backable_candidate(
|
||||
) -> Result<Option<(CandidateHash, Hash)>, Error> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
sender
|
||||
.send_message(ProspectiveParachainsMessage::GetBackableCandidate(
|
||||
.send_message(ProspectiveParachainsMessage::GetBackableCandidates(
|
||||
relay_parent,
|
||||
para_id,
|
||||
1, // core count hardcoded to 1, until elastic scaling is implemented and enabled.
|
||||
required_path,
|
||||
tx,
|
||||
))
|
||||
.await;
|
||||
|
||||
rx.await.map_err(Error::CanceledBackableCandidate)
|
||||
rx.await
|
||||
.map_err(Error::CanceledBackableCandidate)
|
||||
.map(|res| res.get(0).copied())
|
||||
}
|
||||
|
||||
/// The availability bitfield for a given core is the transpose
|
||||
|
||||
@@ -373,13 +373,18 @@ mod select_candidates {
|
||||
let _ = sender.send(response);
|
||||
},
|
||||
AllMessages::ProspectiveParachains(
|
||||
ProspectiveParachainsMessage::GetBackableCandidate(.., tx),
|
||||
) => match prospective_parachains_mode {
|
||||
ProspectiveParachainsMode::Enabled { .. } => {
|
||||
let _ = tx.send(candidates_iter.next());
|
||||
},
|
||||
ProspectiveParachainsMode::Disabled =>
|
||||
panic!("unexpected prospective parachains request"),
|
||||
ProspectiveParachainsMessage::GetBackableCandidates(_, _, count, _, tx),
|
||||
) => {
|
||||
assert_eq!(count, 1);
|
||||
|
||||
match prospective_parachains_mode {
|
||||
ProspectiveParachainsMode::Enabled { .. } => {
|
||||
let _ =
|
||||
tx.send(candidates_iter.next().map_or_else(Vec::new, |c| vec![c]));
|
||||
},
|
||||
ProspectiveParachainsMode::Disabled =>
|
||||
panic!("unexpected prospective parachains request"),
|
||||
}
|
||||
},
|
||||
_ => panic!("Unexpected message: {:?}", from_job),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user