Skip to main content

set_forward_method

Function set_forward_method 

Source
pub fn set_forward_method(
    vault_path: &Path,
    pp: &Passphrase,
    m: LotMethod,
    wallet: Option<WalletId>,
    effective_from: Option<TaxDate>,
    now: OffsetDateTime,
) -> Result<EventId, CliError>
Expand description

M3 / SPEC A.1 / A.5(a): append a MethodElection decision — the forward standing order.

This is an EVENT, not a config flag mutation. The standing order is irrevocable (unless voided) and governs all method-honoring disposals on/after effective_from. Back-dating is blocked by the engine (MethodElectionBackdated hard blocker when effective_from < made-date).

wallet carries the optional per-ACCOUNT scope (§A.5(a)): None = a GLOBAL election (unchanged); Some(WalletId::Exchange{..}) = that exchange account’s method. [R0-M3] Only Exchange wallets are electable (a self:LABEL scope is rejected), and the account MUST be one the vault already knows — an unknown/typo’d account is rejected LOUDLY so it can’t silently create a dead election the user believes is in force. [R0-M1] The scope lives in the MethodElection PAYLOAD, not the LedgerEvent.wallet column (append_decision passes None for the event-level wallet).

When effective_from is None, defaults to the decision’s made-date (now in UTC), which satisfies the effective_from >= made-date invariant by construction.