set fee if txp successfully created
This commit is contained in:
parent
3f2575fa2a
commit
10231c3aa7
|
@ -33,6 +33,7 @@ TxProposal.create = function(opts) {
|
|||
x.status = 'pending';
|
||||
x.actions = [];
|
||||
x.outputOrder = _.shuffle(_.range(2));
|
||||
x.fee = null;
|
||||
|
||||
return x;
|
||||
};
|
||||
|
@ -60,6 +61,7 @@ TxProposal.fromObj = function(obj) {
|
|||
return TxProposalAction.fromObj(action);
|
||||
});
|
||||
x.outputOrder = obj.outputOrder;
|
||||
x.fee = obj.fee;
|
||||
|
||||
return x;
|
||||
};
|
||||
|
|
|
@ -505,6 +505,7 @@ WalletService.prototype._selectTxInputs = function(txp, cb) {
|
|||
txp.inputs = selected;
|
||||
bitcoreTx = txp.getBitcoreTx();
|
||||
txp.inputPaths = _.pluck(txp.inputs, 'path');
|
||||
txp.fee = bitcoreTx.getFee();
|
||||
return cb();
|
||||
} catch (ex) {
|
||||
if (ex.name != 'bitcore.ErrorTransactionFeeError') {
|
||||
|
@ -574,7 +575,6 @@ WalletService.prototype.createTx = function(opts, cb) {
|
|||
requiredRejections: Math.min(wallet.m, wallet.n - wallet.m + 1),
|
||||
});
|
||||
|
||||
|
||||
self._selectTxInputs(txp, function(err) {
|
||||
if (err) return cb(err);
|
||||
|
||||
|
|
|
@ -803,6 +803,8 @@ describe('Copay server', function() {
|
|||
tx.message.should.equal('some message');
|
||||
tx.isAccepted().should.equal.false;
|
||||
tx.isRejected().should.equal.false;
|
||||
tx.amount.should.equal(helpers.toSatoshi(80));
|
||||
tx.fee.should.equal(Bitcore.Transaction.FEE_PER_KB);
|
||||
server.getPendingTxs({}, function(err, txs) {
|
||||
should.not.exist(err);
|
||||
txs.length.should.equal(1);
|
||||
|
|
Loading…
Reference in New Issue