Update and fix transaction error documentation (#7998)

This commit is contained in:
Jack May
2020-01-28 15:59:50 -08:00
committed by GitHub
parent 4ffd7693d6
commit fed3817ed3

View File

@ -14,17 +14,18 @@ use thiserror::Error;
/// Reasons a transaction might be rejected. /// Reasons a transaction might be rejected.
#[derive(Error, Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] #[derive(Error, Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub enum TransactionError { pub enum TransactionError {
/// This Pubkey is being processed in another transaction /// An account is already being processed in another transaction in a way
/// that does not support parallelism
AccountInUse, AccountInUse,
/// Pubkey appears twice in the same transaction, typically in a pay-to-self /// A `Pubkey` appears twice in the transaction's `account_keys`. Instructions can reference
/// transaction. /// `Pubkey`s more than once but the message must contain a list with no duplicate keys
AccountLoadedTwice, AccountLoadedTwice,
/// Attempt to debit from `Pubkey`, but no found no record of a prior credit. /// Attempt to debit an account but found no record of a prior credit.
AccountNotFound, AccountNotFound,
/// Attempt to load program from `Pubkey`, but it doesn't exist. /// Attempt to load a program that does not exist
ProgramAccountNotFound, ProgramAccountNotFound,
/// The from `Pubkey` does not have sufficient balance to pay the fee to schedule the transaction /// The from `Pubkey` does not have sufficient balance to pay the fee to schedule the transaction
@ -33,7 +34,7 @@ pub enum TransactionError {
/// This account may not be used to pay transaction fees /// This account may not be used to pay transaction fees
InvalidAccountForFee, InvalidAccountForFee,
/// The bank has seen `Signature` before. This can occur under normal operation /// The bank has seen this `Signature` before. This can occur under normal operation
/// when a UDP packet is duplicated, as a user error from a client not updating /// when a UDP packet is duplicated, as a user error from a client not updating
/// its `recent_blockhash`, or as a double-spend attack. /// its `recent_blockhash`, or as a double-spend attack.
DuplicateSignature, DuplicateSignature,
@ -42,13 +43,14 @@ pub enum TransactionError {
/// the `recent_blockhash` has been discarded. /// the `recent_blockhash` has been discarded.
BlockhashNotFound, BlockhashNotFound,
/// The program returned an error /// An error occurred while processing an instruction. The first element of the tuple
/// indicates the instruction index in which the error occurred.
InstructionError(u8, InstructionError), InstructionError(u8, InstructionError),
/// Loader call chain too deep /// Loader call chain is too deep
CallChainTooDeep, CallChainTooDeep,
/// Transaction has a fee but has no signature present /// Transaction requires a fee but has no signature present
MissingSignatureForFee, MissingSignatureForFee,
/// Transaction contains an invalid account reference /// Transaction contains an invalid account reference