feat: ProblematicTransaction error variant

This commit is contained in:
Jude Nelson
2022-07-22 12:42:30 -04:00
parent 441e1d0e6b
commit 2a965385db

View File

@@ -118,6 +118,7 @@ pub enum Error {
PoxAlreadyLocked,
PoxInsufficientBalance,
PoxNoRewardCycle,
ProblematicTransaction(Txid),
}
impl From<marf_error> for Error {
@@ -188,6 +189,11 @@ impl fmt::Display for Error {
r
)
}
Error::ProblematicTransaction(ref txid) => write!(
f,
"Transaction {} is problematic and will not be mined again",
txid
),
}
}
}
@@ -221,6 +227,7 @@ impl error::Error for Error {
Error::PoxInsufficientBalance => None,
Error::PoxNoRewardCycle => None,
Error::StacksTransactionSkipped(ref _r) => None,
Error::ProblematicTransaction(ref _txid) => None,
}
}
}
@@ -254,6 +261,7 @@ impl Error {
Error::PoxInsufficientBalance => "PoxInsufficientBalance",
Error::PoxNoRewardCycle => "PoxNoRewardCycle",
Error::StacksTransactionSkipped(ref _r) => "StacksTransactionSkipped",
Error::ProblematicTransaction(ref _txid) => "ProblematicTransaction",
}
}
@@ -543,6 +551,14 @@ pub struct TransactionContractCall {
pub function_args: Vec<Value>,
}
impl TransactionContractCall {
pub fn contract_identifier(&self) -> QualifiedContractIdentifier {
let standard_principal =
StandardPrincipalData(self.address.version, self.address.bytes.0.clone());
QualifiedContractIdentifier::new(standard_principal, self.contract_name.clone())
}
}
/// A transaction that instantiates a smart contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TransactionSmartContract {