Skip to content
Draft
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
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev = "74818ceb9
grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "74818ceb95805f56f141d24ca41f58b75c031a7f" }
grovedb-epoch-based-storage-flags = { git = "https://github.com/dashpay/grovedb", rev = "74818ceb95805f56f141d24ca41f58b75c031a7f" }
grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "74818ceb95805f56f141d24ca41f58b75c031a7f" }
dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "719de34bd90792efa77aa5e1065ab21ac09206ee" }
dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "719de34bd90792efa77aa5e1065ab21ac09206ee" }
dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "719de34bd90792efa77aa5e1065ab21ac09206ee" }
key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "719de34bd90792efa77aa5e1065ab21ac09206ee" }
key-wallet-ffi = { git = "https://github.com/dashpay/rust-dashcore", rev = "719de34bd90792efa77aa5e1065ab21ac09206ee" }
key-wallet-manager = { git = "https://github.com/dashpay/rust-dashcore", rev = "719de34bd90792efa77aa5e1065ab21ac09206ee" }
dash-network = { git = "https://github.com/dashpay/rust-dashcore", rev = "719de34bd90792efa77aa5e1065ab21ac09206ee" }
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", rev = "719de34bd90792efa77aa5e1065ab21ac09206ee" }
dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "0c0dca374e47a3c308110aaa58f0ac7590229a5e" }
dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "0c0dca374e47a3c308110aaa58f0ac7590229a5e" }
dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "0c0dca374e47a3c308110aaa58f0ac7590229a5e" }
key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "0c0dca374e47a3c308110aaa58f0ac7590229a5e" }
key-wallet-ffi = { git = "https://github.com/dashpay/rust-dashcore", rev = "0c0dca374e47a3c308110aaa58f0ac7590229a5e" }
key-wallet-manager = { git = "https://github.com/dashpay/rust-dashcore", rev = "0c0dca374e47a3c308110aaa58f0ac7590229a5e" }
dash-network = { git = "https://github.com/dashpay/rust-dashcore", rev = "0c0dca374e47a3c308110aaa58f0ac7590229a5e" }
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", rev = "0c0dca374e47a3c308110aaa58f0ac7590229a5e" }
tokio-metrics = "0.5"

# Size-tuned profile for the iOS `rs-unified-sdk-ffi` staticlib, which
Expand Down
31 changes: 31 additions & 0 deletions packages/rs-platform-wallet-ffi/src/core_wallet_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,37 @@ pub struct UtxoCreditVerdictFFI {
pub spent_at_height: u32,
}

/// One change to a wallet's locked outpoints, carried by the persistence
/// extension's `on_persist_wallet_changeset_outpoint_locks_fn` slot.
///
/// A locked outpoint is kept out of coin selection: the collateral of a
/// masternode registration the wallet processed (spending it would end the
/// registration), or an outpoint locked by hand. The lock does not need a
/// coin behind it, so a host keeps it apart from its UTXO rows, keyed by
/// `(wallet_id, outpoint)`, and hands every stored lock back through the
/// `on_load_wallet_locked_outpoints_fn` slot.
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct OutpointLockFFI {
pub outpoint: OutPointFFI,
/// `true`: store the lock. `false`: delete it.
pub locked: bool,
}

/// Project a changeset's outpoint locks into their C mirrors for the
/// extension slot, in outpoint order.
pub(crate) fn build_outpoint_locks_for_callback(
cs: &platform_wallet::changeset::CoreChangeSet,
) -> Vec<OutpointLockFFI> {
cs.outpoint_locks
.iter()
.map(|(outpoint, locked)| OutpointLockFFI {
outpoint: OutPointFFI::from(outpoint),
locked: *locked,
})
.collect()
}

/// Project a changeset's credit verdicts into their C mirrors for the
/// extension slot, in outpoint order (the map's own ordering — stable,
/// so a host log of a round is reproducible).
Expand Down
2 changes: 2 additions & 0 deletions packages/rs-platform-wallet-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub mod masternode_update_service;
pub mod masternode_withdrawal;
pub mod memory_explorer;
pub mod mnemonic_words;
pub mod outpoint_locks;
pub mod parse_state_transition;
pub mod persistence;
pub mod platform_address_sync;
Expand Down Expand Up @@ -142,6 +143,7 @@ pub use manager::*;
pub use manager_diagnostics::*;
pub use memory_explorer::*;
pub use mnemonic_words::*;
pub use outpoint_locks::*;
pub use persistence::*;
pub use platform_address_sync::*;
pub use platform_address_types::*;
Expand Down
19 changes: 16 additions & 3 deletions packages/rs-platform-wallet-ffi/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ use crate::event_handler::{
};
use crate::handle::*;
use crate::persistence::{
FFIPersister, FreeTrackedMasternodesFn, LoadIdentityBalanceBlockTimeFn,
LoadTrackedMasternodesFn, PersistDpnsNameStatesFn, PersistIdentityBalanceBlockTimeFn,
PersistTrackedMasternodesFn, PersistWalletChangesetChainLockHeightFn,
FFIPersister, FreeTrackedMasternodesFn, FreeWalletLockedOutpointsFn,
LoadIdentityBalanceBlockTimeFn, LoadTrackedMasternodesFn, LoadWalletLockedOutpointsFn,
PersistDpnsNameStatesFn, PersistIdentityBalanceBlockTimeFn, PersistTrackedMasternodesFn,
PersistWalletChangesetChainLockHeightFn, PersistWalletChangesetOutpointLocksFn,
PersistWalletChangesetSweepsFn, PersistWalletChangesetUtxoVerdictsFn, PersistenceCallbacks,
PersistenceCallbacksExtension, PersistenceCapabilitiesFFI, PersistenceExtensionCallbacks,
PLATFORM_WALLET_PERSISTENCE_CALLBACKS_EXTENSION_VERSION,
Expand Down Expand Up @@ -277,6 +278,18 @@ unsafe fn persistence_extension_callbacks(
on_load_identity_balance_block_time_fn,
LoadIdentityBalanceBlockTimeFn
),
wallet_changeset_outpoint_locks: slot!(
on_persist_wallet_changeset_outpoint_locks_fn,
PersistWalletChangesetOutpointLocksFn
),
load_wallet_locked_outpoints: slot!(
on_load_wallet_locked_outpoints_fn,
LoadWalletLockedOutpointsFn
),
load_wallet_locked_outpoints_free: slot!(
on_load_wallet_locked_outpoints_free_fn,
FreeWalletLockedOutpointsFn
),
}
}

Expand Down
Loading
Loading