Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #170 from matiu/bug/proposalsignature
Browse files Browse the repository at this point in the history
normalize to null payproURL
  • Loading branch information
matiu committed Nov 6, 2015
2 parents aff5c55 + 6c7c5f0 commit f8a60b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1208,12 +1208,12 @@ API.prototype._computeProposalSignature = function(args) {
return _.pick(output, ['toAddress', 'amount', 'message']);
}),
message: args.message || null,
payProUrl: args.payProUrl
payProUrl: args.payProUrl || null,
};
hash = WalletUtils.getProposalHash(proposalHeader);
} else {
$.shouldBeNumber(args.amount);
hash = WalletUtils.getProposalHash(args.toAddress, args.amount, args.message || null, args.payProUrl);
hash = WalletUtils.getProposalHash(args.toAddress, args.amount, args.message || null, args.payProUrl || null);
}
return WalletUtils.signMessage(hash, this.credentials.requestPrivKey);
}
Expand Down Expand Up @@ -1287,7 +1287,7 @@ API.prototype.sendTxProposal = function(opts, cb) {
amount: opts.amount,
message: API._encryptMessage(opts.message, this.credentials.sharedEncryptingKey) || null,
feePerKb: opts.feePerKb,
payProUrl: opts.payProUrl,
payProUrl: opts.payProUrl || null,
excludeUnconfirmedUtxos: !!opts.excludeUnconfirmedUtxos,
type: opts.type,
outputs: _.cloneDeep(opts.outputs),
Expand Down
4 changes: 2 additions & 2 deletions lib/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ Verifier.checkTxProposalBody = function(credentials, txp) {
var proposalHeader = {
outputs: outputs,
message: txp.encryptedMessage || txp.message || null,
payProUrl: txp.payProUrl
payProUrl: txp.payProUrl || null,
};
hash = WalletUtils.getProposalHash(proposalHeader);
} else {
hash = WalletUtils.getProposalHash(txp.toAddress, txp.amount, txp.encryptedMessage || txp.message || null, txp.payProUrl);
hash = WalletUtils.getProposalHash(txp.toAddress, txp.amount, txp.encryptedMessage || txp.message || null, txp.payProUrl || null);
}
log.debug('Regenerating & verifying tx proposal hash -> Hash: ', hash, ' Signature: ', txp.proposalSignature);

Expand Down

0 comments on commit f8a60b5

Please sign in to comment.