@ -203,16 +203,16 @@ Transaction.prototype.getSerializationError = function(opts) {
var isFullySigned = this . isFullySigned ( ) ;
if ( ! opts . disableDifferentFees && feeIsDifferent ) {
return new errors . Transaction . FeeError ( feeIsDifferent ) ;
return new errors . Transaction . Different FeeError( feeIsDifferent ) ;
}
if ( ! opts . disableLargeFees && feeIsTooLarge ) {
if ( missingChange ) {
return new errors . Transaction . ChangeAddressMissing ( 'Fee is too large and no change address was provided' ) ;
}
return new errors . Transaction . FeeError ( feeIsTooLarge ) ;
return new errors . Transaction . Large FeeError( feeIsTooLarge ) ;
}
if ( ! opts . disableSmallFees && feeIsTooSmall ) {
return new errors . Transaction . FeeError ( feeIsTooSmall ) ;
return new errors . Transaction . Small FeeError( feeIsTooSmall ) ;
}
if ( ! opts . disableDustOutputs && this . _ hasDustOutputs ( ) ) {
return new errors . Transaction . DustOutputs ( ) ;
@ -226,27 +226,28 @@ Transaction.prototype.getSerializationError = function(opts) {
} ;
Transaction . prototype . _ isFeeDifferent = function ( ) {
var fee = this . getFee ( ) ;
var unspent = this . _ getUnspentValue ( ) ;
if ( fee !== unspent ) {
return 'Unspent value ' + unspent + ' is different from specified fee ' +
fee + ' and no change address is specified' ;
if ( ! _ . isUndefined ( this . _ fee ) ) {
var fee = this . _ fee ;
var unspent = this . _ getUnspentValue ( ) ;
if ( fee !== unspent ) {
return 'Unspent value is ' + unspent + ' but specified fee is ' + fee ;
}
}
} ;
Transaction . prototype . _ isFeeTooLarge = function ( ) {
var fee = this . getFe e( ) ;
var fee = this . _ getUnspentValu e( ) ;
var maximumFee = Math . floor ( Transaction . FEE_SECURITY_MARGIN * this . _ estimateFee ( ) ) ;
if ( fee > maximumFee ) {
return 'Fee is too large: expected less than ' + maximumFee + ' but got ' + fee ;
return 'expected less than ' + maximumFee + ' but got ' + fee ;
}
} ;
Transaction . prototype . _ isFeeTooSmall = function ( ) {
var fee = this . getFe e( ) ;
var fee = this . _ getUnspentValu e( ) ;
var minimumFee = Math . ceil ( this . _ estimateFee ( ) / Transaction . FEE_SECURITY_MARGIN ) ;
if ( fee < minimumFee ) {
return 'Fee is too small: expected more than ' + minimumFee + ' but got ' + fee ;
return 'expected more than ' + minimumFee + ' but got ' + fee ;
}
} ;