pub struct Transaction {Show 14 fields
pub timestamp: Timestamp,
pub from: Vec<Slip>,
pub to: Vec<Slip>,
pub data: Vec<u8>,
pub transaction_type: TransactionType,
pub txs_replacements: u32,
pub signature: SaitoSignature,
pub path: Vec<Hop>,
pub hash_for_signature: Option<SaitoHash>,
pub total_in: Currency,
pub total_out: Currency,
pub total_fees: Currency,
pub total_work_for_me: Currency,
pub cumulative_fees: Currency,
}
Fields§
§timestamp: Timestamp
§from: Vec<Slip>
§to: Vec<Slip>
§data: Vec<u8>
§transaction_type: TransactionType
§txs_replacements: u32
§signature: SaitoSignature
§path: Vec<Hop>
§hash_for_signature: Option<SaitoHash>
§total_in: Currency
total nolan in input slips
total_out: Currency
total nolan in output slips
total_fees: Currency
total fees
total_work_for_me: Currency
total work to creator
cumulative_fees: Currency
cumulative fees for this tx-in-block
Implementations§
Source§impl Transaction
impl Transaction
pub fn add_hop( &mut self, my_private_key: &SaitoPrivateKey, my_public_key: &SaitoPublicKey, to_public_key: &SaitoPublicKey, )
Sourcepub fn add_from_slip(&mut self, input_slip: Slip)
pub fn add_from_slip(&mut self, input_slip: Slip)
Sourcepub fn add_to_slip(&mut self, output_slip: Slip)
pub fn add_to_slip(&mut self, output_slip: Slip)
Sourcepub fn create(
wallet: &mut Wallet,
to_public_key: SaitoPublicKey,
with_payment: Currency,
with_fee: Currency,
_force_merge: bool,
network: Option<&Network>,
latest_block_id: u64,
genesis_period: u64,
) -> Result<Transaction, Error>
pub fn create( wallet: &mut Wallet, to_public_key: SaitoPublicKey, with_payment: Currency, with_fee: Currency, _force_merge: bool, network: Option<&Network>, latest_block_id: u64, genesis_period: u64, ) -> Result<Transaction, Error>
this function exists largely for testing. It attempts to attach the requested fee to the transaction if possible. If not possible it reverts back to a transaction with 1 zero-fee input and 1 zero-fee output.
§Arguments
wallet_lock
:to_publickey
:with_payment
:with_fee
:
returns: Transaction
§Examples
pub fn create_with_multiple_payments( wallet: &mut Wallet, keys: Vec<SaitoPublicKey>, payments: Vec<Currency>, with_fee: Currency, network: Option<&Network>, latest_block_id: u64, genesis_period: u64, ) -> Result<Transaction, Error>
Sourcepub fn create_issuance_transaction(
to_public_key: SaitoPublicKey,
with_amount: Currency,
) -> Transaction
pub fn create_issuance_transaction( to_public_key: SaitoPublicKey, with_amount: Currency, ) -> Transaction
Sourcepub fn create_rebroadcast_transaction(
transaction_to_rebroadcast: &Transaction,
to_slip: Slip,
from_slip: Slip,
) -> Transaction
pub fn create_rebroadcast_transaction( transaction_to_rebroadcast: &Transaction, to_slip: Slip, from_slip: Slip, ) -> Transaction
pub fn create_rebroadcast_bound_transaction( transaction_to_rebroadcast: &Transaction, slip1: Slip, slip2: Slip, slip3: Slip, ) -> Transaction
pub async fn delete(&self, utxoset: &mut UtxoSet) -> bool
Sourcepub fn deserialize_from_net(bytes: &[u8]) -> Result<Transaction, Error>
pub fn deserialize_from_net(bytes: &[u8]) -> Result<Transaction, Error>
Deserialize from bytes to a Transaction. [len of inputs - 4 bytes - u32] [len of outputs - 4 bytes - u32] [len of message - 4 bytes - u32] [len of path - 4 bytes - u32] [signature - 64 bytes - Secp25k1 sig] [timestamp - 8 bytes - u64] [transaction type - 1 byte] [input][input][input]… [output][output][output]… [message] [hop][hop][hop]…
pub fn is_fee_transaction(&self) -> bool
pub fn is_staking_transaction(&self) -> bool
pub fn is_atr_transaction(&self) -> bool
pub fn is_normal_transaction(&self) -> bool
pub fn is_golden_ticket(&self) -> bool
pub fn is_issuance_transaction(&self) -> bool
pub fn generate( &mut self, public_key: &SaitoPublicKey, tx_index: u64, block_id: u64, ) -> bool
pub fn generate_cumulative_fees( &mut self, cumulative_fees: Currency, ) -> Currency
pub fn generate_total_fees(&mut self, tx_index: u64, block_id: u64)
Sourcepub fn generate_total_work(&mut self, public_key: &SaitoPublicKey)
pub fn generate_total_work(&mut self, public_key: &SaitoPublicKey)
calculate cumulative routing work in block
pub fn generate_hash_for_signature(&mut self)
pub fn get_winning_routing_node(&self, random_hash: SaitoHash) -> SaitoPublicKey
Sourcepub fn on_chain_reorganization(
&self,
utxoset: &mut UtxoSet,
longest_chain: bool,
)
pub fn on_chain_reorganization( &self, utxoset: &mut UtxoSet, longest_chain: bool, )
Runs when the chain is re-organized
Sourcepub fn serialize_for_net(&self) -> Vec<u8> ⓘ
pub fn serialize_for_net(&self) -> Vec<u8> ⓘ
[len of inputs - 4 bytes - u32] [len of outputs - 4 bytes - u32] [len of message - 4 bytes - u32] [len of path - 4 bytes - u32] [signature - 64 bytes - Secp25k1 sig] [timestamp - 8 bytes - u64] [transaction type - 1 byte] [input][input][input]… [output][output][output]… [message] [hop][hop][hop]…
Sourcepub fn get_serialized_size(&self) -> usize
pub fn get_serialized_size(&self) -> usize
Returns the size of the serialized transaction buffer without serializing
pub fn serialize_for_signature(&self) -> Vec<u8> ⓘ
pub fn sign(&mut self, private_key: &SaitoPrivateKey)
pub fn validate( &self, utxoset: &UtxoSet, blockchain: &Blockchain, validate_against_utxo: bool, ) -> bool
pub fn validate_against_utxoset(&self, utxoset: &UtxoSet) -> bool
pub fn validate_routing_path(&self) -> bool
pub fn is_in_path(&self, public_key: &SaitoPublicKey) -> bool
pub fn is_from(&self, public_key: &SaitoPublicKey) -> bool
pub fn is_to(&self, public_key: &SaitoPublicKey) -> bool
pub fn is_nft(&self, slips: &[Slip], i: usize) -> bool
Trait Implementations§
Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more