pub fn create_transaction<L: Ledger, R: RngCore + CryptoRng>(
    ledger: &mut L,
    tx_out: &TxOut,
    sender: &AccountKey,
    recipient: &PublicAddress,
    tombstone_block: BlockIndex,
    rng: &mut R,
) -> Tx {
    // Get the output value.
    let tx_out_public_key = RistrettoPublic::try_from(&tx_out.public_key).unwrap();
    let shared_secret = get_tx_out_shared_secret(sender.view_private_key(), &tx_out_public_key);
    let (value, _blinding) = tx_out.amount.get_value(&shared_secret).unwrap();

    assert!(value >= BASE_FEE);
    create_transaction_with_amount(
        ledger,
        tx_out,
        sender,
        recipient,
        value - BASE_FEE,
        BASE_FEE,
        tombstone_block,
        rng,
    )
}
/// Creates a transaction that sends the full value of `tx_out` to a single recipient.
///
/// # Arguments:
/// * `ledger` - A ledger containing `tx_out`.
/// * `tx_out` - The TxOut that will be spent.
/// * `sender` - The owner of `tx_out`.
/// * `recipient` - The recipient of the new transaction.
/// * `tombstone_block` - The tombstone block for the new transaction.
/// * `rng` - The randomness used by this function
Creates a transaction that sends the full value of `tx_out` to a single recipient.
Creates a transaction that sends the full value of ` tx_out ` to a single recipient .
pub fn create_transaction<L: Ledger, R: RngCore + CryptoRng>(
    ledger: &mut L,
    tx_out: &TxOut,
    sender: &AccountKey,
    recipient: &PublicAddress,
    tombstone_block: BlockIndex,
    rng: &mut R,
) -> Tx {
    // Get the output value.
    let tx_out_public_key = RistrettoPublic::try_from(&tx_out.public_key).unwrap();
    let shared_secret = get_tx_out_shared_secret(sender.view_private_key(), &tx_out_public_key);
    let (value, _blinding) = tx_out.amount.get_value(&shared_secret).unwrap();
    assert!(value >= BASE_FEE);
    create_transaction_with_amount(
        ledger,
        tx_out,
        sender,
        recipient,
        value - BASE_FEE,
        BASE_FEE,
        tombstone_block,
        rng,
    )
}
pub fn create_transaction < L : Ledger , R : RngCore + CryptoRng > ( ledger : & mut L , tx_out : & TxOut , sender : & AccountKey , recipient : & PublicAddress , tombstone_block : BlockIndex , rng : & mut R , ) -> Tx { // Get the output value. let tx_out_public_key = RistrettoPublic :: try_from ( & tx_out . public_key ) . unwrap ( ) ; let shared_secret = get_tx_out_shared_secret ( sender . view_private_key ( ) , & tx_out_public_key ) ; let ( value , _blinding ) = tx_out . amount . get_value ( & shared_secret ) . unwrap ( ) ; assert ! ( value BASE_FEE ) ; create_transaction_with_amount ( ledger , tx_out , sender , recipient , value - BASE_FEE , BASE_FEE , tombstone_block , rng , ) }
Creates a transaction that sends the full value of `tx_out` to a single recipient.
Creates a transaction that sends the full value of ` tx_out ` to a single recipient .
ledger
&mut L
tx_out
&TxOut
sender
&AccountKey
recipient
&PublicAddress
tombstone_block
BlockIndex
rng
&mut R
ledger
&mut L
tx_out
&TxOut
sender
&AccountKey
recipient
&PublicAddress
tombstone_block
BlockIndex
rng
&mut R
arguments:
`ledger` - A ledger containing `tx_out`.
`tx_out` - The TxOut that will be spent.
`sender` - The owner of `tx_out`.
`recipient` - The recipient of the new transaction.
`tombstone_block` - The tombstone block for the new transaction.
`rng` - The randomness used by this function
` ledger ` - A ledger containing ` tx_out ` . ` tx_out ` - The TxOut that will be spent . ` sender ` - The owner of ` tx_out ` . ` recipient ` - The recipient of the new transaction . ` tombstone_block ` - The tombstone block for the new transaction . ` rng ` - The randomness used by this function