Skip to content
Open
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
46 changes: 23 additions & 23 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 @@ -52,14 +52,14 @@ members = [
]

[workspace.dependencies]
dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "173ffac0fdc0c73dda0626cf385bbcfcf2437aeb" }
dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "173ffac0fdc0c73dda0626cf385bbcfcf2437aeb" }
dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "173ffac0fdc0c73dda0626cf385bbcfcf2437aeb" }
key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "173ffac0fdc0c73dda0626cf385bbcfcf2437aeb" }
key-wallet-ffi = { git = "https://github.com/dashpay/rust-dashcore", rev = "173ffac0fdc0c73dda0626cf385bbcfcf2437aeb" }
key-wallet-manager = { git = "https://github.com/dashpay/rust-dashcore", rev = "173ffac0fdc0c73dda0626cf385bbcfcf2437aeb" }
dash-network = { git = "https://github.com/dashpay/rust-dashcore", rev = "173ffac0fdc0c73dda0626cf385bbcfcf2437aeb" }
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", rev = "173ffac0fdc0c73dda0626cf385bbcfcf2437aeb" }
dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "0f9485909142e2cab165ef96c7f8ad245d9bec3c" }
dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "0f9485909142e2cab165ef96c7f8ad245d9bec3c" }
dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "0f9485909142e2cab165ef96c7f8ad245d9bec3c" }
key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "0f9485909142e2cab165ef96c7f8ad245d9bec3c" }
key-wallet-ffi = { git = "https://github.com/dashpay/rust-dashcore", rev = "0f9485909142e2cab165ef96c7f8ad245d9bec3c" }
key-wallet-manager = { git = "https://github.com/dashpay/rust-dashcore", rev = "0f9485909142e2cab165ef96c7f8ad245d9bec3c" }
dash-network = { git = "https://github.com/dashpay/rust-dashcore", rev = "0f9485909142e2cab165ef96c7f8ad245d9bec3c" }
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", rev = "0f9485909142e2cab165ef96c7f8ad245d9bec3c" }

tokio-metrics = "0.5"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,22 @@ internal object WalletManagerNative {
external fun coreWalletDestroy(coreHandle: Long)

/**
* `core_wallet_signed_payment_finalize` — atomically fund, reserve, sign,
* AND register a builder for deferred (BIP70/BIP270) submission in one
* native call. Selection and reservation commit as a single unit under the
* `core_wallet_signed_payment_finalize_with_deliverable` — atomically fund,
* reserve, sign, AND register a builder for deferred (BIP70/BIP270)
* submission in one native call. Selection and reservation commit as a single unit under the
Comment thread
coderabbitai[bot] marked this conversation as resolved.
* wallet-manager lock, closing the double-selection window. CONSUMES
* [builder]. [accountType]/[accountIndex] identify the funding account
* (0 BIP44, 1 BIP32, 2 CoinJoin); [coreSignerHandle] is a
* `MnemonicResolverHandle`.
*
* Returns a big-endian BLOB decoded into a `SignedCoreTransaction`:
* `u64 token, u64 feeDuffs, u32 txidLen, txid utf8, u32 txBytesLen, txBytes`.
* `u64 token, u64 feeDuffs, u64 deliverableDuffs, u32 txidLen, txid utf8,
* u32 txBytesLen, txBytes`.
*
* `deliverableDuffs` sits between `feeDuffs` and `txidLen`, so every field
* after it shifts by eight bytes against the pre-drain layout. It is the
* value of the transaction's sole non-OP_RETURN output, or 0 when there is
* no single such output.
*/
external fun coreWalletFinalizeSignedPayment(
builder: Long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,31 @@ class CoreTransactionBuilder internal constructor(network: Network) : AutoClosea

/**
* Coin-selection strategy — mirror of key-wallet's `SelectionStrategy`
* (`CoreSelectionStrategyFFI`). [ALL] drains the account.
* (`CoreSelectionStrategyFFI`).
*
* [ALL] drains — it selects every spendable UTXO the chosen funding
* source offers, sets the single destination output to
* `total inputs − fee`, and leaves no change. **Its scope is whatever
* [AccountType] names, not "the wallet's main account":**
*
* - [AccountType.BIP44] / [AccountType.BIP32] / [AccountType.COIN_JOIN]
* drain that one account family;
* - [AccountType.ALL_SPENDABLE] — **the default** — drains BIP44 **and**
* BIP32 **and** every DashPay contact-receiving account, in one
* transaction.
*
* So `selectionStrategy = ALL` on a call that does not name an
* [AccountType] sweeps the wallet's whole spendable balance, contact
* receiving accounts included. That is the intended shape of a drain: a
* host asking to send everything means everything it can sign for, and
* before the pooled selector existed a host had to sweep accounts
* together on-chain first to achieve it. Name a single [AccountType] only
* when the drain is genuinely scoped to one family — a CoinJoin sweep,
* say, which must stay in its own privacy domain.
*
* Read what a drain actually pays from
* [SignedCoreTransaction.deliverableAmountDuffs]; the engine computes it,
* and the caller's requested amount is discarded.
*/
enum class SelectionStrategy(val ffiValue: Int) {
SMALLEST_FIRST(0),
Expand Down
Loading
Loading