fixed small bug in getPendingTxProposals
This commit is contained in:
parent
5e9c72bdf1
commit
dcb561a2b0
1 changed files with 21 additions and 23 deletions
|
|
@ -1363,30 +1363,28 @@ Wallet.prototype.getPendingTxProposals = function() {
|
||||||
var txps = this.getTxProposals();
|
var txps = this.getTxProposals();
|
||||||
var satToUnit = 1 / this.settings.unitToSatoshi;
|
var satToUnit = 1 / this.settings.unitToSatoshi;
|
||||||
|
|
||||||
_.find(txps, function(txp) {
|
_.each(_.where(txps, 'isPending'), function(txp) {
|
||||||
if (txp.isPending) {
|
pendingForUs++;
|
||||||
pendingForUs++;
|
var addresses = {};
|
||||||
var addresses = {};
|
var outs = JSON.parse(txp.builder.vanilla.outs);
|
||||||
var outs = JSON.parse(txp.builder.vanilla.outs);
|
outs.forEach(function(o) {
|
||||||
outs.forEach(function(o) {
|
if (!self.publicKeyRing.addressToPath[o.Straddress]) {
|
||||||
if (!self.publicKeyRing.addressToPath[o.Straddress]) {
|
if (!addresses[o.address]) addresses[o.address] = 0;
|
||||||
if (!addresses[o.address]) addresses[o.address] = 0;
|
addresses[o.address] += (o.amountSatStr || Math.round(o.amount * bitcore.util.COIN));
|
||||||
addresses[o.address] += (o.amountSatStr || Math.round(o.amount * bitcore.util.COIN));
|
};
|
||||||
};
|
});
|
||||||
|
txp.outs = [];
|
||||||
|
_.each(addresses, function(value, address) {
|
||||||
|
txp.outs.push({
|
||||||
|
address: address,
|
||||||
|
value: value * satToUnit
|
||||||
});
|
});
|
||||||
txp.outs = [];
|
});
|
||||||
_.each(addresses, function(value, address) {
|
// extra fields
|
||||||
txp.outs.push({
|
txp.fee = txp.builder.feeSat * satToUnit;
|
||||||
address: address,
|
txp.missingSignatures = txp.builder.build().countInputMissingSignatures(0);
|
||||||
value: value * satToUnit
|
txp.actionList = self._getActionList(txp.peerActions);
|
||||||
});
|
ret.txs.push(txp);
|
||||||
});
|
|
||||||
// extra fields
|
|
||||||
txp.fee = txp.builder.feeSat * satToUnit;
|
|
||||||
txp.missingSignatures = txp.builder.build().countInputMissingSignatures(0);
|
|
||||||
txp.actionList = self._getActionList(txp.peerActions);
|
|
||||||
ret.txs.push(txp);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ret.pendingForUs = pendingForUs;
|
ret.pendingForUs = pendingForUs;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue