persist feeLevel as part of txp

This commit is contained in:
Ivan Socolsky 2016-08-22 20:34:22 -03:00
parent c5e4c4b9a4
commit 04b8d2afa2
No known key found for this signature in database
GPG Key ID: FAECE6A05FAA4F56
3 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,7 @@ TxProposal.create = function(opts) {
x.requiredRejections = Math.min(x.walletM, x.walletN - x.walletM + 1), x.requiredRejections = Math.min(x.walletM, x.walletN - x.walletM + 1),
x.status = 'temporary'; x.status = 'temporary';
x.actions = []; x.actions = [];
x.feeLevel = opts.feeLevel;
x.feePerKb = opts.feePerKb; x.feePerKb = opts.feePerKb;
x.excludeUnconfirmedUtxos = opts.excludeUnconfirmedUtxos; x.excludeUnconfirmedUtxos = opts.excludeUnconfirmedUtxos;
@ -98,6 +99,7 @@ TxProposal.fromObj = function(obj) {
}); });
x.outputOrder = obj.outputOrder; x.outputOrder = obj.outputOrder;
x.fee = obj.fee; x.fee = obj.fee;
x.feeLevel = obj.feeLevel;
x.feePerKb = obj.feePerKb; x.feePerKb = obj.feePerKb;
x.excludeUnconfirmedUtxos = obj.excludeUnconfirmedUtxos; x.excludeUnconfirmedUtxos = obj.excludeUnconfirmedUtxos;
x.addressType = obj.addressType; x.addressType = obj.addressType;

View File

@ -1860,6 +1860,7 @@ WalletService.prototype.createTx = function(opts, cb) {
outputs: opts.outputs, outputs: opts.outputs,
message: opts.message, message: opts.message,
changeAddress: changeAddress, changeAddress: changeAddress,
feeLevel: opts.feeLevel,
feePerKb: feePerKb, feePerKb: feePerKb,
payProUrl: opts.payProUrl, payProUrl: opts.payProUrl,
walletM: wallet.m, walletM: wallet.m,

View File

@ -2286,6 +2286,7 @@ describe('Wallet service', function() {
tx.isTemporary().should.equal.true; tx.isTemporary().should.equal.true;
tx.amount.should.equal(helpers.toSatoshi(0.8)); tx.amount.should.equal(helpers.toSatoshi(0.8));
tx.feePerKb.should.equal(123e2); tx.feePerKb.should.equal(123e2);
should.not.exist(tx.feeLevel);
server.getPendingTxs({}, function(err, txs) { server.getPendingTxs({}, function(err, txs) {
should.not.exist(err); should.not.exist(err);
txs.should.be.empty; txs.should.be.empty;
@ -2766,6 +2767,7 @@ describe('Wallet service', function() {
should.not.exist(err); should.not.exist(err);
should.exist(txp); should.exist(txp);
txp.feePerKb.should.equal(180e2); txp.feePerKb.should.equal(180e2);
txp.feeLevel.should.equal('economy');
done(); done();
}); });
}); });
@ -2805,6 +2807,7 @@ describe('Wallet service', function() {
should.not.exist(err); should.not.exist(err);
should.exist(txp); should.exist(txp);
txp.feePerKb.should.equal(200e2); txp.feePerKb.should.equal(200e2);
txp.feeLevel.should.equal('normal');
done(); done();
}); });
}); });