Surface AccountInUse to JSON RPC users so they know to retry the transaction
This commit is contained in:
@@ -302,6 +302,7 @@ impl Bank {
|
||||
if res[i] != Err(BankError::SignatureNotFound) {
|
||||
let status = match res[i] {
|
||||
Ok(_) => RpcSignatureStatus::Confirmed,
|
||||
Err(BankError::AccountInUse) => RpcSignatureStatus::AccountInUse,
|
||||
Err(BankError::ProgramRuntimeError(_)) => {
|
||||
RpcSignatureStatus::ProgramRuntimeError
|
||||
}
|
||||
|
@@ -90,10 +90,11 @@ impl Metadata for Meta {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Serialize, Debug)]
|
||||
pub enum RpcSignatureStatus {
|
||||
AccountInUse,
|
||||
Confirmed,
|
||||
SignatureNotFound,
|
||||
ProgramRuntimeError,
|
||||
GenericFailure,
|
||||
ProgramRuntimeError,
|
||||
SignatureNotFound,
|
||||
}
|
||||
|
||||
build_rpc_trait! {
|
||||
@@ -157,6 +158,7 @@ impl RpcSol for RpcSolImpl {
|
||||
Ok(
|
||||
match meta.request_processor.get_signature_status(signature) {
|
||||
Ok(_) => RpcSignatureStatus::Confirmed,
|
||||
Err(BankError::AccountInUse) => RpcSignatureStatus::AccountInUse,
|
||||
Err(BankError::ProgramRuntimeError(_)) => RpcSignatureStatus::ProgramRuntimeError,
|
||||
Err(BankError::SignatureNotFound) => RpcSignatureStatus::SignatureNotFound,
|
||||
Err(err) => {
|
||||
|
Reference in New Issue
Block a user