Browse Source

replaced other regex checks for client version

activeAddress
Ivan Socolsky 9 years ago
parent
commit
db5c452a74
  1. 12
      lib/server.js

12
lib/server.js

@ -546,6 +546,14 @@ WalletService.prototype._clientSupportsBIP44 = function() {
return true;
};
WalletService.prototype._clientSupportsTXPv2 = function() {
var version = this._parseClientVersion();
if (!version) return false;
if (version.agent != 'bwc') return true; // Asume 3rd party clients are up-to-date
if (version.major == 0 && version.minor == 0) return false;
return true;
};
/**
* Joins a wallet in creation.
* @param {Object} opts
@ -1224,7 +1232,7 @@ WalletService.prototype.createTx = function(opts, cb) {
var txp = Model.TxProposal.create(txOpts);
if (!self.clientVersion || /^bw.-0\.0\./.test(self.clientVersion)) {
if (!self._clientSupportsTXPv2()) {
txp.version = '1.0.1';
}
@ -1393,7 +1401,7 @@ WalletService.prototype.signTx = function(opts, cb) {
}, function(err, txp) {
if (err) return cb(err);
if (!self.clientVersion || /^bw.-0\.0\./.test(self.clientVersion)) {
if (!self._clientSupportsTXPv2()) {
if (!_.startsWith(txp.version, '1.')) {
return cb(new ClientError(Errors.codes.UPGRADE_NEEDED, 'To sign this spend proposal you need to upgrade your client app.'));
}

Loading…
Cancel
Save