Skip to content

Instantly share code, notes, and snippets.

@harshvishu
Last active March 4, 2021 15:25
Show Gist options
  • Save harshvishu/737a500e03d48dab0a9d03025f7b26f2 to your computer and use it in GitHub Desktop.
Save harshvishu/737a500e03d48dab0a9d03025f7b26f2 to your computer and use it in GitHub Desktop.
/**
Creates a new transaction to go into the next mined Block
- Parameter sender: Address of the Sender
- Parameter recipient: Address of the Recipient
- Parameter amount: Amount
- returns: The index of the Block that will hold this transaction
*/
pub fn new_transaction(&mut self, sender: String, recipient: String, amount: u64) -> u64 {
self.current_transactions
.push(Transaction::new(sender, recipient, amount));
(self.current_transactions.len() - 1) as u64
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment