Merge pull request #1093 from chjj/paypro

paypro: fix - use safeUnspent for createPaymentTxSync.
This commit is contained in:
Matias Alejo Garcia 2014-08-15 09:49:44 -04:00
commit 3ab28b61e4
1 changed files with 10 additions and 2 deletions

View File

@ -933,7 +933,7 @@ Wallet.prototype.receivePaymentRequest = function(options, pr, cb) {
return cb(new Error('No unspent outputs available.'));
}
try {
self.createPaymentTxSync(options, merchantData, unspent);
self.createPaymentTxSync(options, merchantData, safeUnspent);
} catch (e) {
var msg = e.message || '';
if (msg.indexOf('not enough unspent tx outputs to fulfill')) {
@ -946,7 +946,7 @@ Wallet.prototype.receivePaymentRequest = function(options, pr, cb) {
return cb(null, merchantData, pr);
}
var ntxid = self.createPaymentTxSync(options, merchantData, unspent);
var ntxid = self.createPaymentTxSync(options, merchantData, safeUnspent);
if (ntxid) {
self.sendIndexes();
self.sendTxProposal(ntxid);
@ -1137,6 +1137,14 @@ Wallet.prototype.createPaymentTxSync = function(options, merchantData, unspent)
}
};
if (typeof opts.spendUnconfirmed === 'undefined') {
opts.spendUnconfirmed = this.spendUnconfirmed;
}
for (var k in Wallet.builderOpts) {
opts[k] = Wallet.builderOpts[k];
}
merchantData.total = bignum(merchantData.total, 10);
var outs = [];