mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -68,6 +68,7 @@ void printHelp(const po::options_description& desc)
|
||||
cerr << "Commands: " << endl;
|
||||
cerr << " account_domain_set <seed> <paying_account> [<domain>]" << endl;
|
||||
cerr << " account_email_set <seed> <paying_account> [<email_address>]" << endl;
|
||||
cerr << " account_tx <account>|<nickname>|<account_public_key> <ledger>|(<minledger> <maxledger>)" << endl;
|
||||
cerr << " account_lines <account>|<nickname>|<account_public_key> [<index>]" << endl;
|
||||
cerr << " account_offers <account>|<nickname>|<account_public_key> [<index>]" << endl;
|
||||
cerr << " account_info <account>|<nickname>" << endl;
|
||||
|
||||
@@ -29,22 +29,22 @@ var Account = function (remote, account) {
|
||||
|
||||
this.on('newListener', function (type, listener) {
|
||||
if (Account.subscribe_events.indexOf(type) !== -1) {
|
||||
if (!this._subs && 'open' === this._remote._online_state) {
|
||||
this._remote.request_subscribe()
|
||||
.accounts(this._account_id)
|
||||
if (!self._subs && 'open' === self._remote._online_state) {
|
||||
self._remote.request_subscribe()
|
||||
.accounts(self._account_id)
|
||||
.request();
|
||||
}
|
||||
this._subs += 1;
|
||||
self._subs += 1;
|
||||
}
|
||||
});
|
||||
|
||||
this.on('removeListener', function (type, listener) {
|
||||
if (Account.subscribe_events.indexOf(type) !== -1) {
|
||||
this._subs -= 1;
|
||||
self._subs -= 1;
|
||||
|
||||
if (!this._subs && 'open' === this._remote._online_state) {
|
||||
this._remote.request_unsubscribe()
|
||||
.accounts(this._account_id)
|
||||
if (!self._subs && 'open' === self._remote._online_state) {
|
||||
self._remote.request_unsubscribe()
|
||||
.accounts(self._account_id)
|
||||
.request();
|
||||
}
|
||||
}
|
||||
@@ -52,8 +52,8 @@ var Account = function (remote, account) {
|
||||
|
||||
this._remote.on('connect', function () {
|
||||
if (self._subs) {
|
||||
this._remote.request_subscribe()
|
||||
.accounts(this._account_id)
|
||||
self._remote.request_subscribe()
|
||||
.accounts(self._account_id)
|
||||
.request();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -111,7 +111,17 @@ Amount.prototype.add = function (v) {
|
||||
result._is_negative = s.compareTo(BigInteger.ZERO) < 0;
|
||||
result._value = result._is_negative ? s.negate() : s;
|
||||
}
|
||||
else {
|
||||
else if (v.is_zero()) {
|
||||
result = this;
|
||||
}
|
||||
else if (this.is_zero()) {
|
||||
result = v.clone();
|
||||
// YYY Why are these cloned? We never modify them.
|
||||
result._currency = this._currency.clone();
|
||||
result._issuer = this._issuer.clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
var v1 = this._is_negative ? this._value.negate() : this._value;
|
||||
var o1 = this._offset;
|
||||
var v2 = v._is_negative ? v._value.negate() : v._value;
|
||||
@@ -418,6 +428,10 @@ Amount.prototype.is_negative = function () {
|
||||
: false; // NaN is not negative
|
||||
};
|
||||
|
||||
Amount.prototype.is_positive = function () {
|
||||
return !this.is_zero() && !this.is_negative();
|
||||
};
|
||||
|
||||
// Only checks the value. Not the currency and issuer.
|
||||
Amount.prototype.is_valid = function () {
|
||||
return this._value instanceof BigInteger;
|
||||
@@ -695,6 +709,7 @@ Amount.prototype.set_currency = function (c) {
|
||||
{
|
||||
c.copyTo(this._currency);
|
||||
}
|
||||
this._is_native = this._currency.is_native();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -20,8 +20,8 @@ var UInt = function () {
|
||||
this._value = NaN;
|
||||
};
|
||||
|
||||
UInt.json_rewrite = function (j) {
|
||||
return this.from_json(j).to_json();
|
||||
UInt.json_rewrite = function (j, opts) {
|
||||
return this.from_json(j).to_json(opts);
|
||||
};
|
||||
|
||||
// Return a new UInt from j.
|
||||
|
||||
@@ -59,8 +59,8 @@ UInt160.prototype.to_json = function (opts) {
|
||||
|
||||
var output = Base.encode_check(Base.VER_ACCOUNT_ID, this.to_bytes());
|
||||
|
||||
if (config.gateways && output in config.gateways && !opts.no_gateway)
|
||||
output = config.gateways[output];
|
||||
if (opts.gateways && output in opts.gateways)
|
||||
output = opts.gateways[output];
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user