From 1dedb2b1900ea0f1ce262612b2c271cb0ec9425f Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 11 Feb 2013 21:24:42 -0800 Subject: [PATCH] Arthur found a missing constructor that breaks handling negative native amounts. --- src/cpp/ripple/SerializedTypes.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/cpp/ripple/SerializedTypes.h b/src/cpp/ripple/SerializedTypes.h index 0a05fa225..de87ed0ec 100644 --- a/src/cpp/ripple/SerializedTypes.h +++ b/src/cpp/ripple/SerializedTypes.h @@ -249,6 +249,18 @@ public: : SerializedType(n), mValue(v), mOffset(0), mIsNative(true), mIsNegative(isNeg) { ; } + STAmount(SField::ref n, int64 v) + : SerializedType(n), mOffset(0), mIsNative(true), mIsNegative(false) + { + if (v < 0) + { + mIsNegative = true; + mValue = static_cast(-v); + } + else + mValue = static_cast(v); + } + STAmount(const uint160& uCurrencyID, const uint160& uIssuerID, uint64 uV = 0, int iOff = 0, bool bNegative = false) : mCurrency(uCurrencyID), mIssuer(uIssuerID), mValue(uV), mOffset(iOff), mIsNegative(bNegative) { canonicalize(); }