mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-22 01:36:56 +01:00
Merge pull request #193 from bigchaindb/fixing_forEach
changed forEach method
This commit is contained in:
commit
2b665dc5ca
@ -228,11 +228,12 @@ export default class Transaction {
|
|||||||
*/
|
*/
|
||||||
static signTransaction(transaction, ...privateKeys) {
|
static signTransaction(transaction, ...privateKeys) {
|
||||||
const signedTx = clone(transaction)
|
const signedTx = clone(transaction)
|
||||||
|
const serializedTransaction =
|
||||||
|
Transaction.serializeTransactionIntoCanonicalString(transaction)
|
||||||
|
|
||||||
signedTx.inputs.forEach((input, index) => {
|
signedTx.inputs.forEach((input, index) => {
|
||||||
const privateKey = privateKeys[index]
|
const privateKey = privateKeys[index]
|
||||||
const privateKeyBuffer = Buffer.from(base58.decode(privateKey))
|
const privateKeyBuffer = Buffer.from(base58.decode(privateKey))
|
||||||
const serializedTransaction =
|
|
||||||
Transaction.serializeTransactionIntoCanonicalString(transaction)
|
|
||||||
|
|
||||||
const transactionUniqueFulfillment = input.fulfills ? serializedTransaction
|
const transactionUniqueFulfillment = input.fulfills ? serializedTransaction
|
||||||
.concat(input.fulfills.transaction_id)
|
.concat(input.fulfills.transaction_id)
|
||||||
@ -245,9 +246,9 @@ export default class Transaction {
|
|||||||
input.fulfillment = fulfillmentUri
|
input.fulfillment = fulfillmentUri
|
||||||
})
|
})
|
||||||
|
|
||||||
const serializedTransaction =
|
const serializedSignedTransaction =
|
||||||
Transaction.serializeTransactionIntoCanonicalString(signedTx)
|
Transaction.serializeTransactionIntoCanonicalString(signedTx)
|
||||||
signedTx.id = sha256Hash(serializedTransaction)
|
signedTx.id = sha256Hash(serializedSignedTransaction)
|
||||||
return signedTx
|
return signedTx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user