add preconditons
This commit is contained in:
parent
cdb8ab94da
commit
57532242a4
|
@ -284,14 +284,12 @@ API.prototype.createAddress = function(cb) {
|
|||
var self = this;
|
||||
|
||||
var data = this._loadAndCheck();
|
||||
$.checkState(data.publicKeyRing.length != data.n, 'Wallet Incomplete, cannot derive address.');
|
||||
|
||||
var url = '/v1/addresses/';
|
||||
this._doPostRequest(url, {}, data, function(err, address) {
|
||||
if (err) return cb(err);
|
||||
|
||||
if (data.publicKeyRing.length != data.n)
|
||||
return cb('Wallet Incomplete, cannot derive address.')
|
||||
|
||||
if (!Verifier.checkAddress(data, address)) {
|
||||
return cb(new ServerCompromisedError('Server sent fake address'));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue