2015-10-30 13:16:20 -07:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var Defaults = {};
|
|
|
|
|
|
|
|
Defaults.MIN_FEE_PER_KB = 0;
|
|
|
|
Defaults.MAX_FEE_PER_KB = 1000000;
|
2016-01-28 12:53:22 -08:00
|
|
|
Defaults.MIN_TX_FEE = 0;
|
2016-01-28 13:11:53 -08:00
|
|
|
Defaults.MAX_TX_FEE = 0.1 * 1e8;
|
2016-02-19 07:30:40 -08:00
|
|
|
Defaults.MAX_TX_SIZE_IN_KB = 100;
|
2015-10-30 13:16:20 -07:00
|
|
|
|
|
|
|
Defaults.MAX_KEYS = 100;
|
|
|
|
|
2016-06-14 08:26:37 -07:00
|
|
|
// Time after which a tx proposal can be erased by any copayer. in seconds
|
|
|
|
Defaults.DELETE_LOCKTIME = 600;
|
2015-10-30 13:16:20 -07:00
|
|
|
|
|
|
|
// Allowed consecutive txp rejections before backoff is applied.
|
2016-03-15 13:21:22 -07:00
|
|
|
Defaults.BACKOFF_OFFSET = 10;
|
2015-10-30 13:16:20 -07:00
|
|
|
|
2016-06-14 08:26:37 -07:00
|
|
|
// Time a copayer need to wait to create a new tx after her previous proposal was rejected. in seconds.
|
|
|
|
Defaults.BACKOFF_TIME = 600;
|
2015-10-30 13:16:20 -07:00
|
|
|
|
|
|
|
Defaults.MAX_MAIN_ADDRESS_GAP = 20;
|
|
|
|
|
|
|
|
// TODO: should allow different gap sizes for external/internal chains
|
2016-03-01 05:56:13 -08:00
|
|
|
Defaults.SCAN_ADDRESS_GAP = Defaults.MAX_MAIN_ADDRESS_GAP + 20;
|
2015-10-30 13:16:20 -07:00
|
|
|
|
2017-08-29 12:33:35 -07:00
|
|
|
Defaults.FEE_LEVELS = {
|
|
|
|
btc: [{
|
|
|
|
name: 'urgent',
|
|
|
|
nbBlocks: 2,
|
|
|
|
multiplier: 1.5,
|
|
|
|
defaultValue: 150000,
|
|
|
|
}, {
|
|
|
|
name: 'priority',
|
|
|
|
nbBlocks: 2,
|
|
|
|
defaultValue: 100000
|
|
|
|
}, {
|
|
|
|
name: 'normal',
|
|
|
|
nbBlocks: 3,
|
|
|
|
defaultValue: 80000
|
|
|
|
}, {
|
|
|
|
name: 'economy',
|
|
|
|
nbBlocks: 6,
|
|
|
|
defaultValue: 50000
|
|
|
|
}, {
|
|
|
|
name: 'superEconomy',
|
|
|
|
nbBlocks: 24,
|
|
|
|
defaultValue: 20000
|
|
|
|
}],
|
|
|
|
bch: [{
|
|
|
|
name: 'normal',
|
|
|
|
nbBlocks: 2,
|
|
|
|
defaultValue: 2000,
|
|
|
|
}]
|
|
|
|
};
|
2016-03-04 06:06:16 -08:00
|
|
|
|
2016-06-27 08:29:37 -07:00
|
|
|
// How many levels to fallback to if the value returned by the network for a given nbBlocks is -1
|
|
|
|
Defaults.FEE_LEVELS_FALLBACK = 2;
|
|
|
|
|
2015-12-10 07:36:30 -08:00
|
|
|
// Minimum nb of addresses a wallet must have to start using 2-step balance optimization
|
|
|
|
Defaults.TWO_STEP_BALANCE_THRESHOLD = 100;
|
|
|
|
|
2017-10-30 13:50:56 -07:00
|
|
|
// Age Limit for addresses to be considered 'active' always
|
|
|
|
Defaults.TWO_STEP_CREATION_HOURS = 24;
|
|
|
|
|
2017-10-31 15:21:36 -07:00
|
|
|
// Time to prevent re-quering inactive addresses (MIN)
|
2017-11-01 07:45:38 -07:00
|
|
|
Defaults.TWO_STEP_INACTIVE_CLEAN_DURATION_MIN = 120;
|
2017-10-31 15:21:36 -07:00
|
|
|
|
2016-01-12 06:53:35 -08:00
|
|
|
Defaults.FIAT_RATE_PROVIDER = 'BitPay';
|
|
|
|
Defaults.FIAT_RATE_FETCH_INTERVAL = 10; // In minutes
|
2016-01-13 11:29:04 -08:00
|
|
|
Defaults.FIAT_RATE_MAX_LOOK_BACK_TIME = 120; // In minutes
|
2016-01-12 06:53:35 -08:00
|
|
|
|
2016-08-03 03:09:12 -07:00
|
|
|
Defaults.HISTORY_LIMIT = 50;
|
2016-02-17 11:45:56 -08:00
|
|
|
|
2016-03-09 05:45:37 -08:00
|
|
|
// The maximum amount of an UTXO to be considered too big to be used in the tx before exploring smaller
|
|
|
|
// alternatives (proportinal to tx amount).
|
2016-03-02 06:26:07 -08:00
|
|
|
Defaults.UTXO_SELECTION_MAX_SINGLE_UTXO_FACTOR = 2;
|
2016-03-09 05:45:37 -08:00
|
|
|
|
|
|
|
// The minimum amount an UTXO need to contribute proportional to tx amount.
|
2016-03-02 06:26:07 -08:00
|
|
|
Defaults.UTXO_SELECTION_MIN_TX_AMOUNT_VS_UTXO_FACTOR = 0.1;
|
|
|
|
|
2016-03-09 05:45:37 -08:00
|
|
|
// The maximum threshold to consider fees non-significant in relation to tx amount.
|
|
|
|
Defaults.UTXO_SELECTION_MAX_FEE_VS_TX_AMOUNT_FACTOR = 0.05;
|
|
|
|
|
|
|
|
// The maximum amount to pay for using small inputs instead of one big input
|
|
|
|
// when fees are significant (proportional to how much we would pay for using that big input only).
|
|
|
|
Defaults.UTXO_SELECTION_MAX_FEE_VS_SINGLE_UTXO_FEE_FACTOR = 5;
|
|
|
|
|
2016-06-10 09:50:57 -07:00
|
|
|
// Minimum allowed amount for tx outputs (including change) in SAT
|
|
|
|
Defaults.MIN_OUTPUT_AMOUNT = 5000;
|
2016-03-23 06:58:01 -07:00
|
|
|
|
2016-07-29 06:51:21 -07:00
|
|
|
// Number of confirmations from which tx in history will be cached
|
|
|
|
// (ie we consider them inmutables)
|
|
|
|
Defaults.CONFIRMATIONS_TO_START_CACHING = 6 * 6; // ~ 6hrs
|
2016-07-27 05:57:54 -07:00
|
|
|
|
2016-07-29 06:51:21 -07:00
|
|
|
// Number of addresses from which tx history is enabled in a wallet
|
2016-07-27 05:57:54 -07:00
|
|
|
Defaults.HISTORY_CACHE_ADDRESS_THRESOLD = 100;
|
|
|
|
|
2016-08-08 06:06:58 -07:00
|
|
|
// Cache time for blockchain height (in seconds)
|
|
|
|
Defaults.BLOCKHEIGHT_CACHE_TIME = 10 * 60;
|
|
|
|
|
2016-08-24 04:50:26 -07:00
|
|
|
|
|
|
|
// Max allowed timespan for notification queries in seconds
|
2016-11-04 07:39:27 -07:00
|
|
|
Defaults.MAX_NOTIFICATIONS_TIMESPAN = 60 * 60 * 24 * 14; // ~ 2 weeks
|
|
|
|
Defaults.NOTIFICATIONS_TIMESPAN = 60;
|
2016-08-24 04:50:26 -07:00
|
|
|
|
2016-08-09 12:45:48 -07:00
|
|
|
Defaults.SESSION_EXPIRATION = 1 * 60 * 60; // 1 hour to session expiration
|
|
|
|
|
2016-11-30 05:53:33 -08:00
|
|
|
Defaults.RateLimit = {
|
|
|
|
createWallet: {
|
|
|
|
windowMs: 60 * 60 * 1000, // hour window
|
2017-10-26 12:59:50 -07:00
|
|
|
delayAfter: 8, // begin slowing down responses after the 3rd request
|
2016-11-30 06:16:29 -08:00
|
|
|
delayMs: 3000, // slow down subsequent responses by 3 seconds per request
|
2017-10-26 12:59:50 -07:00
|
|
|
max: 15, // start blocking after 20 request
|
2016-11-30 06:16:29 -08:00
|
|
|
message: "Too many wallets created from this IP, please try again after an hour"
|
2016-11-30 05:53:33 -08:00
|
|
|
},
|
2017-10-19 10:52:53 -07:00
|
|
|
estimateFee: {
|
|
|
|
windowMs: 60 * 10 *1000, // 10 min window
|
2017-10-26 12:59:50 -07:00
|
|
|
delayAfter: 5, // begin slowing down responses after the 3rd request
|
2017-10-19 10:52:53 -07:00
|
|
|
delayMs: 300, // slow down subsequent responses by 3 seconds per request
|
|
|
|
|
2017-10-26 12:59:50 -07:00
|
|
|
max: 10, // start blocking after 200 request
|
2017-10-19 10:52:53 -07:00
|
|
|
message: "Too many request"
|
|
|
|
},
|
|
|
|
|
2016-11-30 05:53:33 -08:00
|
|
|
// otherPosts: {
|
|
|
|
// windowMs: 60 * 60 * 1000, // 1 hour window
|
|
|
|
// max: 1200 , // 1 post every 3 sec average, max.
|
|
|
|
// },
|
|
|
|
};
|
|
|
|
|
2017-08-23 13:28:35 -07:00
|
|
|
Defaults.COIN = 'btc';
|
|
|
|
|
2015-10-30 13:16:20 -07:00
|
|
|
module.exports = Defaults;
|