paypro: comments.

This commit is contained in:
Christopher Jeffrey 2014-08-05 11:10:31 -07:00 committed by Manuel Araoz
parent 6ccbf292c5
commit 60603306a9
1 changed files with 6 additions and 0 deletions

View File

@ -719,6 +719,8 @@ Wallet.prototype.sign = function(ntxid, cb) {
// } // }
// //
// If this is a payment protocol request,
// ensure it hasn't been tampered with.
if (!self.verifyPaymentRequest(ntxid)) { if (!self.verifyPaymentRequest(ntxid)) {
if (cb) cb(false); if (cb) cb(false);
return; return;
@ -1206,6 +1208,10 @@ Wallet.prototype.createPaymentTxSync = function(options, merchantData, unspent)
return ntxid; return ntxid;
}; };
// This essentially ensures that a copayer hasn't tampered with a
// PaymentRequest message from a payment server. It verifies the signature
// based on the cert, and checks to ensure the desired outputs are the same as
// the ones on the tx proposal.
Wallet.prototype.verifyPaymentRequest = function(ntxid) { Wallet.prototype.verifyPaymentRequest = function(ntxid) {
if (!txp) return false; if (!txp) return false;