Make fallback providers immutable.

This commit is contained in:
ricmoo 2017-04-04 17:27:28 -04:00
parent 8603c836e1
commit c10c3b937c

@ -27,6 +27,7 @@ function FallbackProvider(providers) {
if (!(this instanceof FallbackProvider)) { throw new Error('missing new'); }
Provider.call(this, providers[0].testnet, providers[0].chainId);
providers = providers.slice(0);
Object.defineProperty(this, 'providers', {
get: function() {
return providers.slice(0);
@ -38,7 +39,6 @@ inherits(FallbackProvider, Provider);
utils.defineProperty(FallbackProvider.prototype, 'perform', function(method, params) {
var providers = this.providers;
return new Promise(function(resolve, reject) {
var firstError = null;
function next() {