Created
January 8, 2019 12:25
-
-
Save harshvishu/e21bdb2992ab213d90b333524df2046e to your computer and use it in GitHub Desktop.
Swit-Blockchain-NewTransaction.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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 | |
*/ | |
func newTransaction(sender: String, recipient: String, amount: Int64) -> Int64 { | |
let transaction = Transaction(sender: sender, recipient: recipient, amount: amount) | |
self.current_transactions.append(transaction) | |
return self.last_block.index + 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment