Ignore fee error when unspent output is actually negative, rather than already when the check for negative unspent output is disabled.
This commit is contained in:
parent
ac2fbe2777
commit
3ace170ac5
|
@ -205,7 +205,7 @@ Transaction.prototype._isInvalidSatoshis = function() {
|
|||
};
|
||||
|
||||
Transaction.prototype._hasFeeError = function(opts) {
|
||||
if (opts.disableMoreOutputThanInput) {
|
||||
if (this._getUnspentValue() < 0) {
|
||||
// The concept of a fee is meaningless when the unspent output value is negative.
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -397,6 +397,18 @@ describe('Transaction', function() {
|
|||
return transaction.serialize();
|
||||
}).to.throw(errors.Transaction.InvalidOutputAmountSum);
|
||||
});
|
||||
it('will throw fee error with disableMoreOutputThanInput enabled (but not triggered)', function() {
|
||||
var transaction = new Transaction();
|
||||
transaction.from(simpleUtxoWith1BTC);
|
||||
transaction
|
||||
.to(toAddress, 90000000)
|
||||
.change(changeAddress)
|
||||
.fee(10000000);
|
||||
|
||||
expect(function() {
|
||||
return transaction.serialize({disableMoreOutputThanInput: true});
|
||||
}).to.throw(errors.Transaction.FeeError.TooLarge);
|
||||
});
|
||||
describe('skipping checks', function() {
|
||||
var buildSkipTest = function(builder, check, expectedError) {
|
||||
return function() {
|
||||
|
|
Loading…
Reference in New Issue