node: add getNetworkName method
This commit is contained in:
parent
90e354093c
commit
f3f2f59615
@ -248,6 +248,14 @@ Node.prototype.start = function(callback) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Node.prototype.getNetworkName = function() {
|
||||||
|
var network = this.network.name;
|
||||||
|
if (this.network.regtestEnabled) {
|
||||||
|
network = 'regtest';
|
||||||
|
}
|
||||||
|
return network;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will stop all running services in the reverse order that they
|
* Will stop all running services in the reverse order that they
|
||||||
* were initially started.
|
* were initially started.
|
||||||
|
|||||||
@ -1301,10 +1301,7 @@ Bitcoin.prototype.getInfo = function(callback) {
|
|||||||
return callback(self._wrapRPCError(err));
|
return callback(self._wrapRPCError(err));
|
||||||
}
|
}
|
||||||
var result = response.result;
|
var result = response.result;
|
||||||
result.network = self.node.network.name;
|
result.network = self.node.getNetworkName();
|
||||||
if (self.node.network.regtestEnabled) {
|
|
||||||
result.network = 'regtest';
|
|
||||||
}
|
|
||||||
callback(null, result);
|
callback(null, result);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -49,7 +49,10 @@ describe('Bitcoind Functionality', function() {
|
|||||||
exec: path.resolve(__dirname, '../bin/bitcoind')
|
exec: path.resolve(__dirname, '../bin/bitcoind')
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
network: regtestNetwork
|
network: regtestNetwork,
|
||||||
|
getNetworkName: function() {
|
||||||
|
return 'regtest';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user