Skip to content

Commit 2d21872

Browse files
committed
docs: update documentation about abort_call_back
Previously, this callback returned a boolean indicating whether the transaction should be rolled back. Now it returns an optional string, where the string indicates a reason for the abort.
1 parent faed7c4 commit 2d21872

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

clarity/src/vm/clarity.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ pub trait TransactionConnection: ClarityConnection {
180180
/// * the asset changes during `to_do` in an `AssetMap`
181181
/// * the Stacks events during the transaction
182182
///
183-
/// and a `bool` value which is `true` if the `abort_call_back` caused the changes to abort.
183+
/// and an optional string value which is the result of `abort_call_back`,
184+
/// containing a human-readable reason for aborting the transaction.
184185
///
185186
/// If `to_do` returns an `Err` variant, then the changes are aborted.
186187
fn with_abort_callback<F, A, R, E>(
@@ -301,10 +302,10 @@ pub trait TransactionConnection: ClarityConnection {
301302
}
302303

303304
/// Execute a contract call in the current block.
304-
/// If an error occurs while processing the transaction, its modifications will be rolled back.
305-
/// abort_call_back is called with an AssetMap and a ClarityDatabase reference,
306-
/// if abort_call_back returns true, all modifications from this transaction will be rolled back.
307-
/// otherwise, they will be committed (though they may later be rolled back if the block itself is rolled back).
305+
/// If an error occurs while processing the transaction, its modifications will be rolled back.
306+
/// `abort_call_back` is called with an `AssetMap` and a `ClarityDatabase` reference,
307+
/// If `abort_call_back` returns `Some(reason)`, all modifications from this transaction will be rolled back.
308+
/// Otherwise, they will be committed (though they may later be rolled back if the block itself is rolled back).
308309
#[allow(clippy::too_many_arguments)]
309310
fn run_contract_call<F>(
310311
&mut self,
@@ -359,9 +360,9 @@ pub trait TransactionConnection: ClarityConnection {
359360

360361
/// Initialize a contract in the current block.
361362
/// If an error occurs while processing the initialization, it's modifications will be rolled back.
362-
/// abort_call_back is called with an AssetMap and a ClarityDatabase reference,
363-
/// if abort_call_back returns true, all modifications from this transaction will be rolled back.
364-
/// otherwise, they will be committed (though they may later be rolled back if the block itself is rolled back).
363+
/// `abort_call_back` is called with an `AssetMap` and a `ClarityDatabase` reference,
364+
/// If `abort_call_back` returns `Some(reason)`, all modifications from this transaction will be rolled back.
365+
/// Otherwise, they will be committed (though they may later be rolled back if the block itself is rolled back).
365366
#[allow(clippy::too_many_arguments)]
366367
fn initialize_smart_contract<F>(
367368
&mut self,

0 commit comments

Comments
 (0)