Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,23 @@ sealed class DashSdkError(
cause,
)

/**
* `ErrorMasternodeWithdrawalUnconfirmed` (native code 42). A
* masternode (evonode) identity credit withdrawal was broadcast and
* accepted, but its execution result couldn't be confirmed — it may
* already have executed, and the identity nonce was consumed for it,
* so a blind retry could submit a SECOND withdrawal. Do NOT retry;
* re-read the identity's claimable balance and reconcile first. The
* Android analog of Swift's
* `PlatformWalletError.masternodeWithdrawalUnconfirmed`.
*/
class MasternodeWithdrawalUnconfirmed(message: String, cause: Throwable? = null) :
PlatformWallet(
"$message (do NOT retry: the withdrawal may already have executed; " +
"re-read the claimable balance first)",
cause,
)

/**
* `ErrorShieldedBroadcastFailed` (native code 16). A DEFINITIVE
* non-execution outcome — relay/CheckTx rejected the transaction
Expand Down Expand Up @@ -481,6 +498,7 @@ sealed class DashSdkError(
18 -> PlatformWallet.ShieldedSpendUnconfirmed(message, cause) // ErrorShieldedSpendUnconfirmed
19 -> PlatformWallet.ShieldedNoRecordedAnchor(message, cause) // ErrorShieldedNoRecordedAnchor
20 -> PlatformWallet.TransactionBroadcastUnconfirmed(message, cause) // ErrorTransactionBroadcastUnconfirmed
42 -> PlatformWallet.MasternodeWithdrawalUnconfirmed(message, cause) // ErrorMasternodeWithdrawalUnconfirmed
22 -> PlatformWallet.CoreInsufficientFunds(message, cause) // ErrorCoreInsufficientFunds
23 -> PlatformWallet.AssetLockNotTracked(message, cause) // ErrorAssetLockNotTracked
24 -> PlatformWallet.AssetLockAlreadyConsumed(message, cause) // ErrorAssetLockAlreadyConsumed
Expand Down
16 changes: 16 additions & 0 deletions packages/rs-platform-wallet-ffi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,17 @@ pub enum PlatformWalletFFIResultCode {
/// language-surface compatibility; it is a Platform Payment-account
/// shortfall, not a shielded-note shortfall.
ErrorShieldedInsufficientBalance = 41,
/// Maps `PlatformWalletError::MasternodeWithdrawalUnconfirmed`. A
/// masternode (evonode) identity credit withdrawal was broadcast and
/// accepted, but its execution result could not be confirmed — it may
/// already have executed, and the identity nonce was consumed for it, so
/// a blind retry could submit a SECOND withdrawal. The host must NOT
/// retry; it must re-read the identity's claimable balance (and the
/// payout) and let the user decide from the reconciled state. Definitive
/// rejections (consensus errors, transport verdicts) keep their ordinary
/// codes and stay retryable. Siblings: [`Self::ErrorShieldedSpendUnconfirmed`],
/// [`Self::ErrorTransactionBroadcastUnconfirmed`].
ErrorMasternodeWithdrawalUnconfirmed = 42,

/// The named thing does not exist.
///
Expand Down Expand Up @@ -592,6 +603,11 @@ impl From<PlatformWalletError> for PlatformWalletFFIResult {
PlatformWalletError::TransactionBroadcastUnconfirmed(..) => {
PlatformWalletFFIResultCode::ErrorTransactionBroadcastUnconfirmed
}
// Evonode claim sibling: the ambiguous "may have executed, nonce
// consumed" outcome must reach the host as a typed do-not-retry code.
PlatformWalletError::MasternodeWithdrawalUnconfirmed { .. } => {
PlatformWalletFFIResultCode::ErrorMasternodeWithdrawalUnconfirmed
}
PlatformWalletError::TransactionBroadcast(..) => {
PlatformWalletFFIResultCode::ErrorTransactionBroadcastRejected
}
Expand Down
1 change: 1 addition & 0 deletions packages/rs-platform-wallet-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub mod logging;
pub mod managed_identity;
pub mod manager;
pub mod manager_diagnostics;
pub mod masternode_withdrawal;
pub mod memory_explorer;
pub mod mnemonic_words;
pub mod persistence;
Expand Down
Loading
Loading