paypro: fix - use safeUnspent for createPaymentTxSync.

This commit is contained in:
Christopher Jeffrey 2014-08-14 13:10:31 -04:00
commit 5d3f3f60fe

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 = [];