Skip to content

Commit 67efa49

Browse files
committed
fix(relay): fix borrow and slice conversion in nip-sl simplification
copy uuid out of tx.community().as_uuid() in cancel_schedules_in_transaction (fixes E0716) and convert Option<[u8; 32]> via as_ref().map(<[u8; 32]>::as_slice) instead of as_deref() in scheduled_release::release. Signed-off-by: Kalvin Chau <kalvin@block.xyz>
1 parent 635e4d1 commit 67efa49

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎crates/buzz-db/src/store/scheduled_send.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ pub async fn cancel_schedules_in_transaction(
622622
reason: &str,
623623
now: i64,
624624
) -> Result<u64> {
625-
let community = tx.community().as_uuid();
625+
let community = *tx.community().as_uuid();
626626
let cancelled = match target {
627627
CancelTarget::Pubkey(pubkey) => {
628628
sqlx::query(

‎crates/buzz-relay/src/handlers/scheduled_release.rs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,12 @@ pub(super) async fn release(
334334
if verify_scheduled_message_owner(&message, due_owner_pk, None, not_before as u64).is_err() {
335335
return end_unsent(state, &tenant, &schedule, Some("rejected"), now).await;
336336
}
337-
for key in [Some(due.author.as_slice()), due_owner.as_deref()]
338-
.into_iter()
339-
.flatten()
337+
for key in [
338+
Some(due.author.as_slice()),
339+
due_owner.as_ref().map(<[u8; 32]>::as_slice),
340+
]
341+
.into_iter()
342+
.flatten()
340343
{
341344
let restriction = state
342345
.restriction_state_cached(community, key)

0 commit comments

Comments
 (0)