Skip to content

Commit 1a111e1

Browse files
committed
Use Option::take to move dkg bundle into candidate list.
1 parent 5ecdc01 commit 1a111e1

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

timeboost-sequencer/src/queue.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,14 @@ impl DataSource for BundleQueue {
191191
inner.set_time(time);
192192

193193
if r.is_genesis() || inner.mode.is_passive() {
194-
// allow DKG in passive mode (first 8 rounds from genesis)
195-
let candidate_list = CandidateList::builder(Timestamp::now(), inner.index)
196-
.with_dkg(inner.dkg.clone())
194+
return CandidateList::builder(Timestamp::now(), inner.index)
195+
.with_dkg(inner.dkg.take())
197196
.finish()
198197
.try_into()
199198
.unwrap_or_else(|err| {
200199
error!(%err, "candidate list serialization error");
201200
CandidateListBytes::default()
202201
});
203-
inner.dkg = None;
204-
return candidate_list;
205202
}
206203

207204
let mut size_budget = inner.max_len;
@@ -229,19 +226,16 @@ impl DataSource for BundleQueue {
229226
regular.push(b.clone())
230227
}
231228

232-
let candidate_list = CandidateList::builder(inner.time, inner.index)
229+
CandidateList::builder(inner.time, inner.index)
233230
.with_priority_bundles(priority)
234231
.with_regular_bundles(regular)
235-
.with_dkg(inner.dkg.clone())
232+
.with_dkg(inner.dkg.take())
236233
.finish()
237234
.try_into()
238235
.unwrap_or_else(|err| {
239236
error!(%err, "candidate list serialization error");
240237
CandidateListBytes::default()
241-
});
242-
243-
inner.dkg = None;
244-
candidate_list
238+
})
245239
}
246240
}
247241

0 commit comments

Comments
 (0)