Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed forEach method #193

Merged
merged 2 commits into from
Jun 6, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,12 @@ export default class Transaction {
*/
static signTransaction(transaction, ...privateKeys) {
const signedTx = clone(transaction)
const serializedTransaction =
Transaction.serializeTransactionIntoCanonicalString(transaction)

signedTx.inputs.forEach((input, index) => {
const privateKey = privateKeys[index]
const privateKeyBuffer = Buffer.from(base58.decode(privateKey))
const serializedTransaction =
Transaction.serializeTransactionIntoCanonicalString(transaction)

const transactionUniqueFulfillment = input.fulfills ? serializedTransaction
.concat(input.fulfills.transaction_id)
Expand All @@ -245,9 +246,9 @@ export default class Transaction {
input.fulfillment = fulfillmentUri
})

const serializedTransaction =
const serializedSecondTransaction =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a proper way of calling it as the transaction is the same. You could use serializedSignedTransaction instead or any other that represents better that constant

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was thinking it was a bade naming just want to check

Transaction.serializeTransactionIntoCanonicalString(signedTx)
signedTx.id = sha256Hash(serializedTransaction)
signedTx.id = sha256Hash(serializedSecondTransaction)
return signedTx
}
}