Skip to content

Commit b835a0f

Browse files
committed
review
1 parent 21a4d0f commit b835a0f

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

actors/multisig/src/lib.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,9 @@ impl Actor {
229229

230230
let (_, tx) = ptx
231231
.delete(&params.id.key())
232-
.context_code(
233-
ExitCode::USR_ILLEGAL_STATE,
234-
format!("failed to pop transaction {:?} for cancel", params.id),
235-
)?
232+
.with_context_code(ExitCode::USR_ILLEGAL_STATE, || {
233+
format!("failed to pop transaction {:?} for cancel", params.id)
234+
})?
236235
.ok_or_else(|| {
237236
actor_error!(not_found, "no such transaction {:?} to cancel", params.id)
238237
})?;
@@ -242,10 +241,10 @@ impl Actor {
242241
return Err(actor_error!(forbidden; "Cannot cancel another signers transaction"));
243242
}
244243

245-
let calculated_hash = compute_proposal_hash(&tx, rt).context_code(
246-
ExitCode::USR_ILLEGAL_STATE,
247-
format!("failed to compute proposal hash for (tx: {:?})", params.id),
248-
)?;
244+
let calculated_hash = compute_proposal_hash(&tx, rt)
245+
.with_context_code(ExitCode::USR_ILLEGAL_STATE, || {
246+
format!("failed to compute proposal hash for (tx: {:?})", params.id)
247+
})?;
249248

250249
if !params.proposal_hash.is_empty() && params.proposal_hash != calculated_hash {
251250
return Err(actor_error!(illegal_state, "hash does not match proposal params"));
@@ -456,10 +455,10 @@ impl Actor {
456455
// update approved on the transaction
457456
txn.approved.push(rt.message().caller());
458457

459-
ptx.set(tx_id.key(), txn.clone()).context_code(
460-
ExitCode::USR_ILLEGAL_STATE,
461-
format!("failed to put transaction {} for approval", tx_id.0),
462-
)?;
458+
ptx.set(tx_id.key(), txn.clone())
459+
.with_context_code(ExitCode::USR_ILLEGAL_STATE, || {
460+
format!("failed to put transaction {} for approval", tx_id.0)
461+
})?;
463462

464463
st.pending_txs = ptx.flush().context_code(
465464
ExitCode::USR_ILLEGAL_STATE,

0 commit comments

Comments
 (0)