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
|
||||
* were initially started.
|
||||
|
|
|
@ -1301,10 +1301,7 @@ Bitcoin.prototype.getInfo = function(callback) {
|
|||
return callback(self._wrapRPCError(err));
|
||||
}
|
||||
var result = response.result;
|
||||
result.network = self.node.network.name;
|
||||
if (self.node.network.regtestEnabled) {
|
||||
result.network = 'regtest';
|
||||
}
|
||||
result.network = self.node.getNetworkName();
|
||||
callback(null, result);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -49,7 +49,10 @@ describe('Bitcoind Functionality', function() {
|
|||
exec: path.resolve(__dirname, '../bin/bitcoind')
|
||||
},
|
||||
node: {
|
||||
network: regtestNetwork
|
||||
network: regtestNetwork,
|
||||
getNetworkName: function() {
|
||||
return 'regtest';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue