pub struct CommittedTransaction { /* private fields */ }Expand description
Information about a particular transaction in the blockchain.
§JSON presentation
| Name | Equivalent type | Description |
|---|---|---|
message | Verified<AnyTx> | Transaction as recorded in the blockchain |
location | TxLocation | Location of the transaction in the block |
location_proof | ListProof<Hash> | Proof of transaction inclusion into a block |
status | (custom; see below) | Execution status |
time | DateTime<Utc> | Commitment time* |
* By commitment time we mean an approximate commitment time of the block which includes the transaction. This time is a median time of the precommit local times of each validator.
§status field
The status field is a more readable representation of the ExecutionStatus type.
For successfully executed transactions, status is equal to
{ "type": "success" }For transactions that cause an ExecutionError, status contains the error code
and an optional description, i.e., has the following type in the TypeScript notation:
type Error = {
type: 'service_error' | 'core_error' | 'common_error' | 'runtime_error' | 'unexpected_error',
code?: number,
description?: string,
runtime_id: number,
call_site?: CallSite,
};
type CallSite = MethodCallSite | HookCallSite;
type MethodCallSite = {
call_type: 'method',
instance_id: number,
interface?: string,
method_id: number,
};
type HookCallSite = {
call_type: 'constructor' | 'before_transactions' | 'after_transactions',
instance_id: number,
};Explanations:
Error.typedetermines the component responsible for the error. Usually, errors are generated by the service code, but they can also be caused by the dispatch logic, runtime associated with the service, or come from another source (unexpected_errors).Error.codeis the error code. For service errors, this code is specific to the service instance (which can be obtained fromcall_site), and for runtime errors - to the runtime. For core errors, the codes are fixed; their meaning can be found in theCoreErrordocs. The code is present for all error types exceptunexpected_errors, in which the code is always absent. Besides types listed above, there is also a set of errors that can occur within any context, which are organized in theCommonError.Error.descriptionis an optional human-readable description of the error.Error.runtime_idis the numeric ID of the runtime in which the error has occurred. Note that the runtime is defined for all error types, not justruntime_errors, since for any request it’s possible to say which runtime is responsible for its processing.Error.call_siteprovides most precise known location of the call in which the error has occurred.
Implementations§
Source§impl CommittedTransaction
impl CommittedTransaction
Sourcepub fn location(&self) -> &TxLocation
pub fn location(&self) -> &TxLocation
Returns the transaction location in block.
Sourcepub fn location_proof(&self) -> &ListProof<Hash>
pub fn location_proof(&self) -> &ListProof<Hash>
Returns a proof that transaction is recorded in the blockchain.
Sourcepub fn status(&self) -> Result<(), &ExecutionError>
pub fn status(&self) -> Result<(), &ExecutionError>
Returns the status of the transaction execution.
Trait Implementations§
Source§impl Debug for CommittedTransaction
impl Debug for CommittedTransaction
Source§impl<'de> Deserialize<'de> for CommittedTransaction
impl<'de> Deserialize<'de> for CommittedTransaction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CommittedTransaction
impl RefUnwindSafe for CommittedTransaction
impl Send for CommittedTransaction
impl Sync for CommittedTransaction
impl Unpin for CommittedTransaction
impl UnwindSafe for CommittedTransaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more