pub trait InputSelector {
type Error;
type InputSource: InputSource;
// Required method
fn propose_transaction<ParamsT, ChangeT>(
&self,
params: &ParamsT,
wallet_db: &Self::InputSource,
target_height: TargetHeight,
anchor_height: BlockHeight,
confirmations_policy: ConfirmationsPolicy,
account: <Self::InputSource as InputSource>::AccountId,
transaction_request: TransactionRequest,
change_strategy: &ChangeT,
) -> Result<Proposal<<ChangeT as ChangeStrategy>::FeeRule, <Self::InputSource as InputSource>::NoteRef>, InputSelectorError<<Self::InputSource as InputSource>::Error, Self::Error, ChangeT::Error, <Self::InputSource as InputSource>::NoteRef>>
where ParamsT: Parameters,
ChangeT: ChangeStrategy<MetaSource = Self::InputSource>;
}Expand description
A strategy for selecting transaction inputs and proposing transaction outputs.
Proposals should include only economically useful inputs, as determined by Self::FeeRule;
that is, do not return inputs that cause fees to increase by an amount greater than the value
of the input.
Required Associated Types§
Sourcetype InputSource: InputSource
type InputSource: InputSource
The type of data source that the input selector expects to access to obtain input notes.
This associated type permits input selectors that may use specialized knowledge of the
internals of a particular backing data store, if the generic API of InputSource does not
provide sufficiently fine-grained operations for a particular backing store to optimally
perform input selection.
Required Methods§
Sourcefn propose_transaction<ParamsT, ChangeT>(
&self,
params: &ParamsT,
wallet_db: &Self::InputSource,
target_height: TargetHeight,
anchor_height: BlockHeight,
confirmations_policy: ConfirmationsPolicy,
account: <Self::InputSource as InputSource>::AccountId,
transaction_request: TransactionRequest,
change_strategy: &ChangeT,
) -> Result<Proposal<<ChangeT as ChangeStrategy>::FeeRule, <Self::InputSource as InputSource>::NoteRef>, InputSelectorError<<Self::InputSource as InputSource>::Error, Self::Error, ChangeT::Error, <Self::InputSource as InputSource>::NoteRef>>
fn propose_transaction<ParamsT, ChangeT>( &self, params: &ParamsT, wallet_db: &Self::InputSource, target_height: TargetHeight, anchor_height: BlockHeight, confirmations_policy: ConfirmationsPolicy, account: <Self::InputSource as InputSource>::AccountId, transaction_request: TransactionRequest, change_strategy: &ChangeT, ) -> Result<Proposal<<ChangeT as ChangeStrategy>::FeeRule, <Self::InputSource as InputSource>::NoteRef>, InputSelectorError<<Self::InputSource as InputSource>::Error, Self::Error, ChangeT::Error, <Self::InputSource as InputSource>::NoteRef>>
Performs input selection and returns a proposal for transaction construction including change and fee outputs.
Implementations of this method should return inputs sufficient to satisfy the given transaction request using a best-effort strategy to preserve user privacy, as follows:
- If it is possible to satisfy the specified transaction request by creating a fully-shielded transaction without requiring value to cross pool boundaries, return the inputs necessary to construct such a transaction; otherwise
- If it is possible to satisfy the transaction request by creating a fully-shielded transaction with some amounts crossing between shielded pools, return the inputs necessary.
If insufficient funds are available to satisfy the required outputs for the shielding
request, this operation must fail and return InputSelectorError::InsufficientFunds.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.