mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
in progress
This commit is contained in:
@@ -541,6 +541,7 @@ Json::Value RPCHandler::doPeers(const Json::Value& params)
|
|||||||
// Prior to running allow each to have a credit line of what they will be getting from the other account.
|
// Prior to running allow each to have a credit line of what they will be getting from the other account.
|
||||||
Json::Value RPCHandler::doProfile(const Json::Value ¶ms)
|
Json::Value RPCHandler::doProfile(const Json::Value ¶ms)
|
||||||
{
|
{
|
||||||
|
/* need to fix now that sharedOfferCreate is gone
|
||||||
int iArgs = params.size();
|
int iArgs = params.size();
|
||||||
RippleAddress naSeedA;
|
RippleAddress naSeedA;
|
||||||
RippleAddress naAccountA;
|
RippleAddress naAccountA;
|
||||||
@@ -620,7 +621,8 @@ Json::Value RPCHandler::doProfile(const Json::Value ¶ms)
|
|||||||
obj["end"] = boost::posix_time::to_simple_string(ptEnd);
|
obj["end"] = boost::posix_time::to_simple_string(ptEnd);
|
||||||
obj["interval"] = boost::posix_time::to_simple_string(tdInterval);
|
obj["interval"] = boost::posix_time::to_simple_string(tdInterval);
|
||||||
obj["rate_per_second"] = fRate;
|
obj["rate_per_second"] = fRate;
|
||||||
|
*/
|
||||||
|
Json::Value obj(Json::objectValue);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,441 +106,9 @@ bool Transaction::sign(const RippleAddress& naAccountPrivate)
|
|||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// AccountSet
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setAccountSet(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
bool bEmailHash,
|
|
||||||
const uint128& uEmailHash,
|
|
||||||
bool bWalletLocator,
|
|
||||||
const uint256& uWalletLocator,
|
|
||||||
const uint32 uWalletSize,
|
|
||||||
const RippleAddress& naMessagePublic,
|
|
||||||
bool bDomain,
|
|
||||||
const std::vector<unsigned char>& vucDomain,
|
|
||||||
bool bTransferRate,
|
|
||||||
const uint32 uTransferRate)
|
|
||||||
{
|
|
||||||
if (!bEmailHash)
|
|
||||||
mTransaction->setFieldH128(sfEmailHash, uEmailHash);
|
|
||||||
|
|
||||||
if (!bWalletLocator)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldH256(sfWalletLocator, uWalletLocator);
|
|
||||||
mTransaction->setFieldU32(sfWalletSize, uWalletSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (naMessagePublic.isValid())
|
|
||||||
mTransaction->setFieldVL(sfMessageKey, naMessagePublic.getAccountPublic());
|
|
||||||
|
|
||||||
if (bDomain)
|
|
||||||
mTransaction->setFieldVL(sfDomain, vucDomain);
|
|
||||||
|
|
||||||
if (bTransferRate)
|
|
||||||
mTransaction->setFieldU32(sfTransferRate, uTransferRate);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedAccountSet(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
bool bEmailHash,
|
|
||||||
const uint128& uEmailHash,
|
|
||||||
bool bWalletLocator,
|
|
||||||
const uint256& uWalletLocator,
|
|
||||||
const uint32 uWalletSize,
|
|
||||||
const RippleAddress& naMessagePublic,
|
|
||||||
bool bDomain,
|
|
||||||
const std::vector<unsigned char>& vucDomain,
|
|
||||||
bool bTransferRate,
|
|
||||||
const uint32 uTransferRate)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttACCOUNT_SET, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setAccountSet(naPrivateKey, bEmailHash, uEmailHash,
|
|
||||||
bWalletLocator, uWalletLocator, uWalletSize,
|
|
||||||
naMessagePublic,
|
|
||||||
bDomain, vucDomain, bTransferRate, uTransferRate);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Claim
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setClaim(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const std::vector<unsigned char>& vucGenerator,
|
|
||||||
const std::vector<unsigned char>& vucPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldVL(sfGenerator, vucGenerator);
|
|
||||||
mTransaction->setFieldVL(sfPublicKey, vucPubKey);
|
|
||||||
mTransaction->setFieldVL(sfSignature, vucSignature);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedClaim(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const std::vector<unsigned char>& vucGenerator,
|
|
||||||
const std::vector<unsigned char>& vucPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttCLAIM,
|
|
||||||
naPublicKey, naPublicKey,
|
|
||||||
0, // Sequence of 0.
|
|
||||||
0, // Free.
|
|
||||||
uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setClaim(naPrivateKey, vucGenerator, vucPubKey, vucSignature);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setCreate(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naCreateAccountID,
|
|
||||||
const STAmount& saFund)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldU32(sfFlags, tfCreateAccount);
|
|
||||||
mTransaction->setFieldAccount(sfDestination, naCreateAccountID);
|
|
||||||
mTransaction->setFieldAmount(sfAmount, saFund);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedCreate(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const RippleAddress& naCreateAccountID,
|
|
||||||
const STAmount& saFund)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttPAYMENT, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setCreate(naPrivateKey, naCreateAccountID, saFund);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// CreditSet
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setCreditSet(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const STAmount& saLimitAmount,
|
|
||||||
bool bQualityIn,
|
|
||||||
uint32 uQualityIn,
|
|
||||||
bool bQualityOut,
|
|
||||||
uint32 uQualityOut)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldAmount(sfLimitAmount, saLimitAmount);
|
|
||||||
|
|
||||||
if (bQualityIn)
|
|
||||||
mTransaction->setFieldU32(sfQualityIn, uQualityIn);
|
|
||||||
|
|
||||||
if (bQualityOut)
|
|
||||||
mTransaction->setFieldU32(sfQualityOut, uQualityOut);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedCreditSet(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const STAmount& saLimitAmount,
|
|
||||||
bool bQualityIn,
|
|
||||||
uint32 uQualityIn,
|
|
||||||
bool bQualityOut,
|
|
||||||
uint32 uQualityOut)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttCREDIT_SET, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setCreditSet(naPrivateKey,
|
|
||||||
saLimitAmount,
|
|
||||||
bQualityIn, uQualityIn,
|
|
||||||
bQualityOut, uQualityOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// NicknameSet
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setNicknameSet(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const uint256& uNickname,
|
|
||||||
bool bSetOffer,
|
|
||||||
const STAmount& saMinimumOffer)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldH256(sfNickname, uNickname);
|
|
||||||
|
|
||||||
// XXX Make sure field is present even for 0!
|
|
||||||
if (bSetOffer)
|
|
||||||
mTransaction->setFieldAmount(sfMinimumOffer, saMinimumOffer);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --> bSetOffer: true, change offer
|
|
||||||
// --> saMinimumOffer: 0 to remove.
|
|
||||||
Transaction::pointer Transaction::sharedNicknameSet(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const uint256& uNickname,
|
|
||||||
bool bSetOffer,
|
|
||||||
const STAmount& saMinimumOffer)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttNICKNAME_SET, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setNicknameSet(naPrivateKey, uNickname, bSetOffer, saMinimumOffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// OfferCreate
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setOfferCreate(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
bool bPassive,
|
|
||||||
const STAmount& saTakerPays,
|
|
||||||
const STAmount& saTakerGets,
|
|
||||||
uint32 uExpiration)
|
|
||||||
{
|
|
||||||
if (bPassive)
|
|
||||||
mTransaction->setFieldU32(sfFlags, tfPassive);
|
|
||||||
|
|
||||||
mTransaction->setFieldAmount(sfTakerPays, saTakerPays);
|
|
||||||
mTransaction->setFieldAmount(sfTakerGets, saTakerGets);
|
|
||||||
|
|
||||||
if (uExpiration)
|
|
||||||
mTransaction->setFieldU32(sfExpiration, uExpiration);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedOfferCreate(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
bool bPassive,
|
|
||||||
const STAmount& saTakerPays,
|
|
||||||
const STAmount& saTakerGets,
|
|
||||||
uint32 uExpiration)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttOFFER_CREATE, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setOfferCreate(naPrivateKey, bPassive, saTakerPays, saTakerGets, uExpiration);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// OfferCancel
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setOfferCancel(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
uint32 uSequence)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldU32(sfOfferSequence, uSequence);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedOfferCancel(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
uint32 uSequence)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttOFFER_CANCEL, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setOfferCancel(naPrivateKey, uSequence);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// PasswordFund
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setPasswordFund(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naDstAccountID)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldAccount(sfDestination, naDstAccountID);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedPasswordFund(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const RippleAddress& naDstAccountID)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttPASSWORD_FUND, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setPasswordFund(naPrivateKey, naDstAccountID);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// PasswordSet
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setPasswordSet(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naAuthKeyID,
|
|
||||||
const std::vector<unsigned char>& vucGenerator,
|
|
||||||
const std::vector<unsigned char>& vucPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldAccount(sfAuthorizedKey, naAuthKeyID);
|
|
||||||
mTransaction->setFieldVL(sfGenerator, vucGenerator);
|
|
||||||
mTransaction->setFieldVL(sfPublicKey, vucPubKey);
|
|
||||||
mTransaction->setFieldVL(sfSignature, vucSignature);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedPasswordSet(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const RippleAddress& naAuthKeyID,
|
|
||||||
const std::vector<unsigned char>& vucGenerator,
|
|
||||||
const std::vector<unsigned char>& vucPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttPASSWORD_SET,
|
|
||||||
naPublicKey, naPublicKey,
|
|
||||||
0, // Sequence of 0.
|
|
||||||
0, // Free.
|
|
||||||
uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setPasswordSet(naPrivateKey, naAuthKeyID, vucGenerator, vucPubKey, vucSignature);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Payment
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setPayment(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naDstAccountID,
|
|
||||||
const STAmount& saAmount,
|
|
||||||
const STAmount& saSendMax,
|
|
||||||
const STPathSet& spsPaths,
|
|
||||||
const bool bPartial,
|
|
||||||
const bool bLimit)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldAccount(sfDestination, naDstAccountID);
|
|
||||||
mTransaction->setFieldAmount(sfAmount, saAmount);
|
|
||||||
|
|
||||||
if (saAmount != saSendMax || saAmount.getCurrency() != saSendMax.getCurrency())
|
|
||||||
{
|
|
||||||
mTransaction->setFieldAmount(sfSendMax, saSendMax);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (spsPaths.getPathCount())
|
|
||||||
{
|
|
||||||
mTransaction->setFieldPathSet(sfPaths, spsPaths);
|
|
||||||
}
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedPayment(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const RippleAddress& naDstAccountID,
|
|
||||||
const STAmount& saAmount,
|
|
||||||
const STAmount& saSendMax,
|
|
||||||
const STPathSet& spsPaths,
|
|
||||||
const bool bPartial,
|
|
||||||
const bool bLimit)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttPAYMENT, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setPayment(naPrivateKey, naDstAccountID, saAmount, saSendMax, spsPaths, bPartial, bLimit);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// WalletAdd
|
|
||||||
//
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::setWalletAdd(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const STAmount& saAmount,
|
|
||||||
const RippleAddress& naAuthKeyID,
|
|
||||||
const RippleAddress& naNewPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature)
|
|
||||||
{
|
|
||||||
mTransaction->setFieldAmount(sfAmount, saAmount);
|
|
||||||
mTransaction->setFieldAccount(sfAuthorizedKey, naAuthKeyID);
|
|
||||||
mTransaction->setFieldVL(sfPublicKey, naNewPubKey.getAccountPublic());
|
|
||||||
mTransaction->setFieldVL(sfSignature, vucSignature);
|
|
||||||
|
|
||||||
sign(naPrivateKey);
|
|
||||||
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::pointer Transaction::sharedWalletAdd(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const STAmount& saAmount,
|
|
||||||
const RippleAddress& naAuthKeyID,
|
|
||||||
const RippleAddress& naNewPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature)
|
|
||||||
{
|
|
||||||
pointer tResult = boost::make_shared<Transaction>(ttWALLET_ADD, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
|
||||||
|
|
||||||
return tResult->setWalletAdd(naPrivateKey, saAmount, naAuthKeyID, naNewPubKey, vucSignature);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc.
|
// Misc.
|
||||||
|
|||||||
@@ -58,82 +58,6 @@ private:
|
|||||||
|
|
||||||
SerializedTransaction::pointer mTransaction;
|
SerializedTransaction::pointer mTransaction;
|
||||||
|
|
||||||
Transaction::pointer setAccountSet(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
bool bEmailHash,
|
|
||||||
const uint128& uEmailHash,
|
|
||||||
bool bWalletLocator,
|
|
||||||
const uint256& uWalletLocator,
|
|
||||||
const uint32 uWalletSize,
|
|
||||||
const RippleAddress& naMessagePublic,
|
|
||||||
bool bDomain,
|
|
||||||
const std::vector<unsigned char>& vucDomain,
|
|
||||||
bool bTransferRate,
|
|
||||||
const uint32 uTransferRate);
|
|
||||||
|
|
||||||
Transaction::pointer setClaim(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const std::vector<unsigned char>& vucGenerator,
|
|
||||||
const std::vector<unsigned char>& vucPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature);
|
|
||||||
|
|
||||||
Transaction::pointer setCreate(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naCreateAccountID,
|
|
||||||
const STAmount& saFund);
|
|
||||||
|
|
||||||
Transaction::pointer setCreditSet(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const STAmount& saLimitAmount,
|
|
||||||
bool bQualityIn,
|
|
||||||
uint32 uQualityIn,
|
|
||||||
bool bQualityOut,
|
|
||||||
uint32 uQualityOut);
|
|
||||||
|
|
||||||
Transaction::pointer setNicknameSet(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const uint256& uNickname,
|
|
||||||
bool bSetOffer,
|
|
||||||
const STAmount& saMinimumOffer);
|
|
||||||
|
|
||||||
Transaction::pointer setOfferCreate(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
bool bPassive,
|
|
||||||
const STAmount& saTakerPays,
|
|
||||||
const STAmount& saTakerGets,
|
|
||||||
uint32 uExpiration);
|
|
||||||
|
|
||||||
Transaction::pointer setOfferCancel(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
uint32 uSequence);
|
|
||||||
|
|
||||||
Transaction::pointer setPasswordFund(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naDstAccountID);
|
|
||||||
|
|
||||||
Transaction::pointer setPasswordSet(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naAuthKeyID,
|
|
||||||
const std::vector<unsigned char>& vucGenerator,
|
|
||||||
const std::vector<unsigned char>& vucPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature);
|
|
||||||
|
|
||||||
Transaction::pointer setPayment(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naDstAccountID,
|
|
||||||
const STAmount& saAmount,
|
|
||||||
const STAmount& saSendMax,
|
|
||||||
const STPathSet& spsPaths,
|
|
||||||
const bool bPartial,
|
|
||||||
const bool bLimit);
|
|
||||||
|
|
||||||
Transaction::pointer setWalletAdd(
|
|
||||||
const RippleAddress& naPrivateKey,
|
|
||||||
const STAmount& saAmount,
|
|
||||||
const RippleAddress& naAuthKeyID,
|
|
||||||
const RippleAddress& naNewPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Transaction(SerializedTransaction::ref st, bool bValidate);
|
Transaction(SerializedTransaction::ref st, bool bValidate);
|
||||||
|
|
||||||
@@ -148,130 +72,6 @@ public:
|
|||||||
const STAmount& saFee, // Transaction fee.
|
const STAmount& saFee, // Transaction fee.
|
||||||
uint32 uSourceTag); // User call back value.
|
uint32 uSourceTag); // User call back value.
|
||||||
|
|
||||||
// Change account settings.
|
|
||||||
static Transaction::pointer sharedAccountSet(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
bool bEmailHash,
|
|
||||||
const uint128& uEmailHash,
|
|
||||||
bool bWalletLocator,
|
|
||||||
const uint256& uWalletLocator,
|
|
||||||
const uint32 uWalletSize,
|
|
||||||
const RippleAddress& naMessagePublic,
|
|
||||||
bool bDomain,
|
|
||||||
const std::vector<unsigned char>& vucDomain,
|
|
||||||
bool bTransferRate,
|
|
||||||
const uint32 uTransferRate);
|
|
||||||
|
|
||||||
// Claim a wallet.
|
|
||||||
static Transaction::pointer sharedClaim(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const std::vector<unsigned char>& vucGenerator,
|
|
||||||
const std::vector<unsigned char>& vucPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature);
|
|
||||||
|
|
||||||
// Create an account.
|
|
||||||
static Transaction::pointer sharedCreate(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const RippleAddress& naCreateAccountID, // Account to create.
|
|
||||||
const STAmount& saFund); // Initial funds in XNC.
|
|
||||||
|
|
||||||
// Set credit limit and borrow fees.
|
|
||||||
static Transaction::pointer sharedCreditSet(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const STAmount& saLimitAmount,
|
|
||||||
bool bQualityIn,
|
|
||||||
uint32 uQualityIn,
|
|
||||||
bool bQualityOut,
|
|
||||||
uint32 uQualityOut);
|
|
||||||
|
|
||||||
// Set Nickname
|
|
||||||
static Transaction::pointer sharedNicknameSet(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const uint256& uNickname,
|
|
||||||
bool bSetOffer,
|
|
||||||
const STAmount& saMinimumOffer);
|
|
||||||
|
|
||||||
// Pre-fund password change.
|
|
||||||
static Transaction::pointer sharedPasswordFund(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const RippleAddress& naDstAccountID);
|
|
||||||
|
|
||||||
// Change a password.
|
|
||||||
static Transaction::pointer sharedPasswordSet(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const RippleAddress& naAuthKeyID, // ID of regular public to auth.
|
|
||||||
const std::vector<unsigned char>& vucGenerator,
|
|
||||||
const std::vector<unsigned char>& vucPubKey,
|
|
||||||
const std::vector<unsigned char>& vucSignature);
|
|
||||||
|
|
||||||
// Make a payment.
|
|
||||||
static Transaction::pointer sharedPayment(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const RippleAddress& naDstAccountID,
|
|
||||||
const STAmount& saAmount,
|
|
||||||
const STAmount& saSendMax,
|
|
||||||
const STPathSet& spsPaths,
|
|
||||||
const bool bPartial = false,
|
|
||||||
const bool bLimit = false);
|
|
||||||
|
|
||||||
// Place an offer.
|
|
||||||
static Transaction::pointer sharedOfferCreate(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
bool bPassive,
|
|
||||||
const STAmount& saTakerPays,
|
|
||||||
const STAmount& saTakerGets,
|
|
||||||
uint32 uExpiration);
|
|
||||||
|
|
||||||
// Cancel an offer
|
|
||||||
static Transaction::pointer sharedOfferCancel(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
uint32 uSequence);
|
|
||||||
|
|
||||||
// Add an account to a wallet.
|
|
||||||
static Transaction::pointer sharedWalletAdd(
|
|
||||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
|
||||||
const RippleAddress& naSourceAccount,
|
|
||||||
uint32 uSeq,
|
|
||||||
const STAmount& saFee,
|
|
||||||
uint32 uSourceTag,
|
|
||||||
const STAmount& saAmount, // Initial funds in XNC.
|
|
||||||
const RippleAddress& naAuthKeyID, // ID of regular public to auth.
|
|
||||||
const RippleAddress& naNewPubKey, // Public key of new account
|
|
||||||
const std::vector<unsigned char>& vucSignature); // Proof know new account's private key.
|
|
||||||
|
|
||||||
bool sign(const RippleAddress& naAccountPrivate);
|
bool sign(const RippleAddress& naAccountPrivate);
|
||||||
bool checkSign() const;
|
bool checkSign() const;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TER TransactionEngine::setAuthorized(const SerializedTransaction& txn, bool bMus
|
|||||||
// Verify that submitter knows the private key for the generator.
|
// Verify that submitter knows the private key for the generator.
|
||||||
// Otherwise, people could deny access to generators.
|
// Otherwise, people could deny access to generators.
|
||||||
//
|
//
|
||||||
|
/* JED: taking out generator stuff until we have a better idea of how people will use this
|
||||||
std::vector<unsigned char> vucCipher = txn.getFieldVL(sfGenerator);
|
std::vector<unsigned char> vucCipher = txn.getFieldVL(sfGenerator);
|
||||||
std::vector<unsigned char> vucPubKey = txn.getFieldVL(sfPublicKey);
|
std::vector<unsigned char> vucPubKey = txn.getFieldVL(sfPublicKey);
|
||||||
std::vector<unsigned char> vucSignature = txn.getFieldVL(sfSignature);
|
std::vector<unsigned char> vucSignature = txn.getFieldVL(sfSignature);
|
||||||
@@ -42,6 +42,7 @@ TER TransactionEngine::setAuthorized(const SerializedTransaction& txn, bool bMus
|
|||||||
return tefBAD_GEN_AUTH;
|
return tefBAD_GEN_AUTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create generator.
|
// Create generator.
|
||||||
uint160 hGeneratorID = naAccountPublic.getAccountID();
|
uint160 hGeneratorID = naAccountPublic.getAccountID();
|
||||||
|
|
||||||
@@ -69,6 +70,8 @@ TER TransactionEngine::setAuthorized(const SerializedTransaction& txn, bool bMus
|
|||||||
? hGeneratorID // Claim
|
? hGeneratorID // Claim
|
||||||
: txn.getFieldAccount160(sfAuthorizedKey); // PasswordSet
|
: txn.getFieldAccount160(sfAuthorizedKey); // PasswordSet
|
||||||
|
|
||||||
|
*/
|
||||||
|
uint160 uAuthKeyID=txn.getFieldAccount160(sfAuthorizedKey);
|
||||||
mTxnAccount->setFieldAccount(sfAuthorizedKey, uAuthKeyID);
|
mTxnAccount->setFieldAccount(sfAuthorizedKey, uAuthKeyID);
|
||||||
|
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
@@ -196,17 +199,18 @@ TER TransactionEngine::doClaim(const SerializedTransaction& txn)
|
|||||||
{
|
{
|
||||||
Log(lsINFO) << "doClaim>";
|
Log(lsINFO) << "doClaim>";
|
||||||
|
|
||||||
TER terResult = setAuthorized(txn, true);
|
//TER terResult = setAuthorized(txn, true);
|
||||||
|
TER terResult=tefEXCEPTION;
|
||||||
|
|
||||||
Log(lsINFO) << "doClaim<";
|
Log(lsINFO) << "doClaim<";
|
||||||
|
|
||||||
return terResult;
|
return terResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
TER TransactionEngine::doCreditSet(const SerializedTransaction& txn)
|
TER TransactionEngine::doTrustSet(const SerializedTransaction& txn)
|
||||||
{
|
{
|
||||||
TER terResult = tesSUCCESS;
|
TER terResult = tesSUCCESS;
|
||||||
Log(lsINFO) << "doCreditSet>";
|
Log(lsINFO) << "doTrustSet>";
|
||||||
|
|
||||||
const STAmount saLimitAmount = txn.getFieldAmount(sfLimitAmount);
|
const STAmount saLimitAmount = txn.getFieldAmount(sfLimitAmount);
|
||||||
const bool bQualityIn = txn.isFieldPresent(sfQualityIn);
|
const bool bQualityIn = txn.isFieldPresent(sfQualityIn);
|
||||||
@@ -222,19 +226,19 @@ TER TransactionEngine::doCreditSet(const SerializedTransaction& txn)
|
|||||||
|
|
||||||
if (saLimitAmount.isNegative())
|
if (saLimitAmount.isNegative())
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "doCreditSet: Malformed transaction: Negatived credit limit.";
|
Log(lsINFO) << "doTrustSet: Malformed transaction: Negatived credit limit.";
|
||||||
|
|
||||||
return temBAD_AMOUNT;
|
return temBAD_AMOUNT;
|
||||||
}
|
}
|
||||||
else if (!uDstAccountID)
|
else if (!uDstAccountID)
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "doCreditSet: Malformed transaction: Destination account not specifed.";
|
Log(lsINFO) << "doTrustSet: Malformed transaction: Destination account not specified.";
|
||||||
|
|
||||||
return temDST_NEEDED;
|
return temDST_NEEDED;
|
||||||
}
|
}
|
||||||
else if (mTxnAccountID == uDstAccountID)
|
else if (mTxnAccountID == uDstAccountID)
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "doCreditSet: Malformed transaction: Can not extend credit to self.";
|
Log(lsINFO) << "doTrustSet: Malformed transaction: Can not extend credit to self.";
|
||||||
|
|
||||||
return temDST_IS_SRC;
|
return temDST_IS_SRC;
|
||||||
}
|
}
|
||||||
@@ -242,7 +246,7 @@ TER TransactionEngine::doCreditSet(const SerializedTransaction& txn)
|
|||||||
SLE::pointer sleDst = entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uDstAccountID));
|
SLE::pointer sleDst = entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uDstAccountID));
|
||||||
if (!sleDst)
|
if (!sleDst)
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "doCreditSet: Delay transaction: Destination account does not exist.";
|
Log(lsINFO) << "doTrustSet: Delay transaction: Destination account does not exist.";
|
||||||
|
|
||||||
return terNO_DST;
|
return terNO_DST;
|
||||||
}
|
}
|
||||||
@@ -311,12 +315,12 @@ TER TransactionEngine::doCreditSet(const SerializedTransaction& txn)
|
|||||||
entryModify(sleRippleState);
|
entryModify(sleRippleState);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(lsINFO) << "doCreditSet: Modifying ripple line: bDelIndex=" << bDelIndex;
|
Log(lsINFO) << "doTrustSet: Modifying ripple line: bDelIndex=" << bDelIndex;
|
||||||
}
|
}
|
||||||
// Line does not exist.
|
// Line does not exist.
|
||||||
else if (!saLimitAmount)
|
else if (!saLimitAmount)
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "doCreditSet: Redundant: Setting non-existant ripple line to 0.";
|
Log(lsINFO) << "doTrustSet: Redundant: Setting non-existent ripple line to 0.";
|
||||||
|
|
||||||
return terNO_LINE_NO_ZERO;
|
return terNO_LINE_NO_ZERO;
|
||||||
}
|
}
|
||||||
@@ -325,7 +329,7 @@ TER TransactionEngine::doCreditSet(const SerializedTransaction& txn)
|
|||||||
// Create a new ripple line.
|
// Create a new ripple line.
|
||||||
sleRippleState = entryCreate(ltRIPPLE_STATE, Ledger::getRippleStateIndex(mTxnAccountID, uDstAccountID, uCurrencyID));
|
sleRippleState = entryCreate(ltRIPPLE_STATE, Ledger::getRippleStateIndex(mTxnAccountID, uDstAccountID, uCurrencyID));
|
||||||
|
|
||||||
Log(lsINFO) << "doCreditSet: Creating ripple line: " << sleRippleState->getIndex().ToString();
|
Log(lsINFO) << "doTrustSet: Creating ripple line: " << sleRippleState->getIndex().ToString();
|
||||||
|
|
||||||
sleRippleState->setFieldAmount(sfBalance, STAmount(uCurrencyID, ACCOUNT_ONE)); // Zero balance in currency.
|
sleRippleState->setFieldAmount(sfBalance, STAmount(uCurrencyID, ACCOUNT_ONE)); // Zero balance in currency.
|
||||||
sleRippleState->setFieldAmount(bFlipped ? sfHighLimit : sfLowLimit, saLimitAllow);
|
sleRippleState->setFieldAmount(bFlipped ? sfHighLimit : sfLowLimit, saLimitAllow);
|
||||||
@@ -344,57 +348,13 @@ TER TransactionEngine::doCreditSet(const SerializedTransaction& txn)
|
|||||||
terResult = mNodes.dirAdd(uSrcRef, Ledger::getOwnerDirIndex(uDstAccountID), sleRippleState->getIndex());
|
terResult = mNodes.dirAdd(uSrcRef, Ledger::getOwnerDirIndex(uDstAccountID), sleRippleState->getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(lsINFO) << "doCreditSet<";
|
Log(lsINFO) << "doTrustSet<";
|
||||||
|
|
||||||
return terResult;
|
return terResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
TER TransactionEngine::doNicknameSet(const SerializedTransaction& txn)
|
|
||||||
{
|
|
||||||
std::cerr << "doNicknameSet>" << std::endl;
|
|
||||||
|
|
||||||
const uint256 uNickname = txn.getFieldH256(sfNickname);
|
|
||||||
const bool bMinOffer = txn.isFieldPresent(sfMinimumOffer);
|
|
||||||
const STAmount saMinOffer = bMinOffer ? txn.getFieldAmount(sfAmount) : STAmount();
|
|
||||||
|
|
||||||
SLE::pointer sleNickname = entryCache(ltNICKNAME, uNickname);
|
|
||||||
|
|
||||||
if (sleNickname)
|
|
||||||
{
|
|
||||||
// Edit old entry.
|
|
||||||
sleNickname->setFieldAccount(sfAccount, mTxnAccountID);
|
|
||||||
|
|
||||||
if (bMinOffer && saMinOffer)
|
|
||||||
{
|
|
||||||
sleNickname->setFieldAmount(sfMinimumOffer, saMinOffer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sleNickname->makeFieldAbsent(sfMinimumOffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
entryModify(sleNickname);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Make a new entry.
|
|
||||||
// XXX Need to include authorization limiting for first year.
|
|
||||||
|
|
||||||
sleNickname = entryCreate(ltNICKNAME, Ledger::getNicknameIndex(uNickname));
|
|
||||||
|
|
||||||
std::cerr << "doNicknameSet: Creating nickname node: " << sleNickname->getIndex().ToString() << std::endl;
|
|
||||||
|
|
||||||
sleNickname->setFieldAccount(sfAccount, mTxnAccountID);
|
|
||||||
|
|
||||||
if (bMinOffer && saMinOffer)
|
|
||||||
sleNickname->setFieldAmount(sfMinimumOffer, saMinOffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cerr << "doNicknameSet<" << std::endl;
|
|
||||||
|
|
||||||
return tesSUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
TER TransactionEngine::doPasswordFund(const SerializedTransaction& txn)
|
TER TransactionEngine::doPasswordFund(const SerializedTransaction& txn)
|
||||||
{
|
{
|
||||||
std::cerr << "doPasswordFund>" << std::endl;
|
std::cerr << "doPasswordFund>" << std::endl;
|
||||||
@@ -428,14 +388,16 @@ TER TransactionEngine::doPasswordFund(const SerializedTransaction& txn)
|
|||||||
|
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
TER TransactionEngine::doPasswordSet(const SerializedTransaction& txn)
|
// TODO: change to take a fee if there is one there
|
||||||
|
TER TransactionEngine::doRegularKeySet(const SerializedTransaction& txn)
|
||||||
{
|
{
|
||||||
std::cerr << "doPasswordSet>" << std::endl;
|
std::cerr << "doRegularKeySet>" << std::endl;
|
||||||
|
|
||||||
if (mTxnAccount->getFlags() & lsfPasswordSpent)
|
if (mTxnAccount->getFlags() & lsfPasswordSpent)
|
||||||
{
|
{
|
||||||
std::cerr << "doPasswordSet: Delay transaction: Funds already spent." << std::endl;
|
std::cerr << "doRegularKeySet: Delay transaction: Funds already spent." << std::endl;
|
||||||
|
|
||||||
return terFUNDS_SPENT;
|
return terFUNDS_SPENT;
|
||||||
}
|
}
|
||||||
@@ -444,7 +406,7 @@ TER TransactionEngine::doPasswordSet(const SerializedTransaction& txn)
|
|||||||
|
|
||||||
TER terResult = setAuthorized(txn, false);
|
TER terResult = setAuthorized(txn, false);
|
||||||
|
|
||||||
std::cerr << "doPasswordSet<" << std::endl;
|
std::cerr << "doRegularKeySet<" << std::endl;
|
||||||
|
|
||||||
return terResult;
|
return terResult;
|
||||||
}
|
}
|
||||||
@@ -477,7 +439,7 @@ TER TransactionEngine::doPayment(const SerializedTransaction& txn, const Transac
|
|||||||
|
|
||||||
if (!uDstAccountID)
|
if (!uDstAccountID)
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "doPayment: Invalid transaction: Payment destination account not specifed.";
|
Log(lsINFO) << "doPayment: Invalid transaction: Payment destination account not specified.";
|
||||||
|
|
||||||
return temDST_NEEDED;
|
return temDST_NEEDED;
|
||||||
}
|
}
|
||||||
@@ -495,7 +457,7 @@ TER TransactionEngine::doPayment(const SerializedTransaction& txn, const Transac
|
|||||||
}
|
}
|
||||||
else if (mTxnAccountID == uDstAccountID && uSrcCurrency == uDstCurrency && !bPaths)
|
else if (mTxnAccountID == uDstAccountID && uSrcCurrency == uDstCurrency && !bPaths)
|
||||||
{
|
{
|
||||||
Log(lsINFO) << boost::str(boost::format("doPayment: Invalid transaction: Redunant transaction: src=%s, dst=%s, src_cur=%s, dst_cur=%s")
|
Log(lsINFO) << boost::str(boost::format("doPayment: Invalid transaction: Redundant transaction: src=%s, dst=%s, src_cur=%s, dst_cur=%s")
|
||||||
% mTxnAccountID.ToString()
|
% mTxnAccountID.ToString()
|
||||||
% uDstAccountID.ToString()
|
% uDstAccountID.ToString()
|
||||||
% uSrcCurrency.ToString()
|
% uSrcCurrency.ToString()
|
||||||
@@ -577,7 +539,7 @@ TER TransactionEngine::doPayment(const SerializedTransaction& txn, const Transac
|
|||||||
if (saSrcXRPBalance < saDstAmount)
|
if (saSrcXRPBalance < saDstAmount)
|
||||||
{
|
{
|
||||||
// Transaction might succeed, if applied in a different order.
|
// Transaction might succeed, if applied in a different order.
|
||||||
Log(lsINFO) << "doPayment: Delay transaction: Insufficent funds.";
|
Log(lsINFO) << "doPayment: Delay transaction: Insufficient funds.";
|
||||||
|
|
||||||
terResult = terUNFUNDED;
|
terResult = terUNFUNDED;
|
||||||
}
|
}
|
||||||
@@ -638,7 +600,7 @@ TER TransactionEngine::doWalletAdd(const SerializedTransaction& txn)
|
|||||||
if (saSrcBalance < saAmount)
|
if (saSrcBalance < saAmount)
|
||||||
{
|
{
|
||||||
std::cerr
|
std::cerr
|
||||||
<< boost::str(boost::format("WalletAdd: Delay transaction: insufficent balance: balance=%s amount=%s")
|
<< boost::str(boost::format("WalletAdd: Delay transaction: insufficient balance: balance=%s amount=%s")
|
||||||
% saSrcBalance.getText()
|
% saSrcBalance.getText()
|
||||||
% saAmount.getText())
|
% saAmount.getText())
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@@ -662,10 +624,6 @@ TER TransactionEngine::doWalletAdd(const SerializedTransaction& txn)
|
|||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
TER TransactionEngine::doInvoice(const SerializedTransaction& txn)
|
|
||||||
{
|
|
||||||
return temUNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take as much as possible. Adjusts account balances. Charges fees on top to taker.
|
// Take as much as possible. Adjusts account balances. Charges fees on top to taker.
|
||||||
// --> uBookBase: The order book to take against.
|
// --> uBookBase: The order book to take against.
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
|||||||
switch (txn.getTxnType())
|
switch (txn.getTxnType())
|
||||||
{
|
{
|
||||||
case ttCLAIM:
|
case ttCLAIM:
|
||||||
case ttPASSWORD_SET:
|
case ttREGULAR_KEY_SET:
|
||||||
saCost = 0;
|
saCost = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ttACCOUNT_SET:
|
case ttACCOUNT_SET:
|
||||||
case ttCREDIT_SET:
|
case ttTRUST_SET:
|
||||||
case ttOFFER_CREATE:
|
case ttOFFER_CREATE:
|
||||||
case ttOFFER_CANCEL:
|
case ttOFFER_CANCEL:
|
||||||
case ttPASSWORD_FUND:
|
case ttPASSWORD_FUND:
|
||||||
@@ -268,7 +268,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ttPASSWORD_SET:
|
case ttREGULAR_KEY_SET:
|
||||||
// Transaction's signing public key must be for the source account.
|
// Transaction's signing public key must be for the source account.
|
||||||
// To prove the master private key made this transaction.
|
// To prove the master private key made this transaction.
|
||||||
if (naSigningPubKey.getAccountID() != mTxnAccountID)
|
if (naSigningPubKey.getAccountID() != mTxnAccountID)
|
||||||
@@ -388,8 +388,8 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
|||||||
terResult = doClaim(txn);
|
terResult = doClaim(txn);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ttCREDIT_SET:
|
case ttTRUST_SET:
|
||||||
terResult = doCreditSet(txn);
|
terResult = doTrustSet(txn);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ttINVALID:
|
case ttINVALID:
|
||||||
@@ -409,16 +409,8 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
|||||||
terResult = doOfferCancel(txn);
|
terResult = doOfferCancel(txn);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ttNICKNAME_SET:
|
case ttREGULAR_KEY_SET:
|
||||||
terResult = doNicknameSet(txn);
|
terResult = doRegularKeySet(txn);
|
||||||
break;
|
|
||||||
|
|
||||||
case ttPASSWORD_FUND:
|
|
||||||
terResult = doPasswordFund(txn);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ttPASSWORD_SET:
|
|
||||||
terResult = doPasswordSet(txn);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ttPAYMENT:
|
case ttPAYMENT:
|
||||||
|
|||||||
@@ -64,13 +64,10 @@ protected:
|
|||||||
|
|
||||||
TER doAccountSet(const SerializedTransaction& txn);
|
TER doAccountSet(const SerializedTransaction& txn);
|
||||||
TER doClaim(const SerializedTransaction& txn);
|
TER doClaim(const SerializedTransaction& txn);
|
||||||
TER doCreditSet(const SerializedTransaction& txn);
|
TER doTrustSet(const SerializedTransaction& txn);
|
||||||
TER doInvoice(const SerializedTransaction& txn);
|
|
||||||
TER doOfferCreate(const SerializedTransaction& txn);
|
TER doOfferCreate(const SerializedTransaction& txn);
|
||||||
TER doOfferCancel(const SerializedTransaction& txn);
|
TER doOfferCancel(const SerializedTransaction& txn);
|
||||||
TER doNicknameSet(const SerializedTransaction& txn);
|
TER doRegularKeySet(const SerializedTransaction& txn);
|
||||||
TER doPasswordFund(const SerializedTransaction& txn);
|
|
||||||
TER doPasswordSet(const SerializedTransaction& txn);
|
|
||||||
TER doPayment(const SerializedTransaction& txn, const TransactionEngineParams params);
|
TER doPayment(const SerializedTransaction& txn, const TransactionEngineParams params);
|
||||||
TER doWalletAdd(const SerializedTransaction& txn);
|
TER doWalletAdd(const SerializedTransaction& txn);
|
||||||
TER doContractAdd(const SerializedTransaction& txn);
|
TER doContractAdd(const SerializedTransaction& txn);
|
||||||
|
|||||||
@@ -28,34 +28,12 @@ static bool TFInit()
|
|||||||
<< SOElement(sfTransferRate, SOE_OPTIONAL)
|
<< SOElement(sfTransferRate, SOE_OPTIONAL)
|
||||||
;
|
;
|
||||||
|
|
||||||
DECLARE_TF(Claim, ttCLAIM)
|
DECLARE_TF(TrustSet, ttTRUST_SET)
|
||||||
<< SOElement(sfGenerator, SOE_REQUIRED)
|
|
||||||
<< SOElement(sfPublicKey, SOE_REQUIRED)
|
|
||||||
<< SOElement(sfSignature, SOE_REQUIRED)
|
|
||||||
;
|
|
||||||
|
|
||||||
DECLARE_TF(CreditSet, ttCREDIT_SET)
|
|
||||||
<< SOElement(sfLimitAmount, SOE_OPTIONAL)
|
<< SOElement(sfLimitAmount, SOE_OPTIONAL)
|
||||||
<< SOElement(sfQualityIn, SOE_OPTIONAL)
|
<< SOElement(sfQualityIn, SOE_OPTIONAL)
|
||||||
<< SOElement(sfQualityOut, SOE_OPTIONAL)
|
<< SOElement(sfQualityOut, SOE_OPTIONAL)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
DECLARE_TF(Invoice, ttINVOICE)
|
|
||||||
<< SOElement(sfTarget, SOE_REQUIRED)
|
|
||||||
<< SOElement(sfAmount, SOE_REQUIRED)
|
|
||||||
<< SOElement(sfDestination, SOE_OPTIONAL)
|
|
||||||
<< SOElement(sfIdentifier, SOE_OPTIONAL)
|
|
||||||
;
|
|
||||||
)
|
|
||||||
*/
|
|
||||||
|
|
||||||
DECLARE_TF(NicknameSet, ttNICKNAME_SET)
|
|
||||||
<< SOElement(sfNickname, SOE_REQUIRED)
|
|
||||||
<< SOElement(sfMinimumOffer, SOE_OPTIONAL)
|
|
||||||
;
|
|
||||||
|
|
||||||
DECLARE_TF(OfferCreate, ttOFFER_CREATE)
|
DECLARE_TF(OfferCreate, ttOFFER_CREATE)
|
||||||
<< SOElement(sfTakerPays, SOE_REQUIRED)
|
<< SOElement(sfTakerPays, SOE_REQUIRED)
|
||||||
<< SOElement(sfTakerGets, SOE_REQUIRED)
|
<< SOElement(sfTakerGets, SOE_REQUIRED)
|
||||||
@@ -66,14 +44,8 @@ static bool TFInit()
|
|||||||
<< SOElement(sfOfferSequence, SOE_REQUIRED)
|
<< SOElement(sfOfferSequence, SOE_REQUIRED)
|
||||||
;
|
;
|
||||||
|
|
||||||
DECLARE_TF(PasswordFund, ttPASSWORD_FUND)
|
DECLARE_TF(SetRegularKey, ttREGULAR_KEY_SET)
|
||||||
<< SOElement(sfDestination, SOE_REQUIRED)
|
|
||||||
;
|
|
||||||
|
|
||||||
DECLARE_TF(PasswordSet, ttPASSWORD_SET)
|
|
||||||
<< SOElement(sfAuthorizedKey, SOE_REQUIRED)
|
<< SOElement(sfAuthorizedKey, SOE_REQUIRED)
|
||||||
<< SOElement(sfGenerator, SOE_REQUIRED)
|
|
||||||
<< SOElement(sfPublicKey, SOE_REQUIRED)
|
|
||||||
;
|
;
|
||||||
|
|
||||||
DECLARE_TF(Payment, ttPAYMENT)
|
DECLARE_TF(Payment, ttPAYMENT)
|
||||||
@@ -84,12 +56,6 @@ static bool TFInit()
|
|||||||
<< SOElement(sfInvoiceID, SOE_OPTIONAL)
|
<< SOElement(sfInvoiceID, SOE_OPTIONAL)
|
||||||
;
|
;
|
||||||
|
|
||||||
DECLARE_TF(WalletAdd, ttWALLET_ADD)
|
|
||||||
<< SOElement(sfAmount, SOE_REQUIRED)
|
|
||||||
<< SOElement(sfAuthorizedKey, SOE_REQUIRED)
|
|
||||||
<< SOElement(sfPublicKey, SOE_REQUIRED)
|
|
||||||
;
|
|
||||||
|
|
||||||
DECLARE_TF(Contract, ttCONTRACT)
|
DECLARE_TF(Contract, ttCONTRACT)
|
||||||
<< SOElement(sfExpiration, SOE_REQUIRED)
|
<< SOElement(sfExpiration, SOE_REQUIRED)
|
||||||
<< SOElement(sfBondAmount, SOE_REQUIRED)
|
<< SOElement(sfBondAmount, SOE_REQUIRED)
|
||||||
|
|||||||
@@ -7,18 +7,18 @@ enum TransactionType
|
|||||||
{
|
{
|
||||||
ttINVALID = -1,
|
ttINVALID = -1,
|
||||||
ttPAYMENT = 0,
|
ttPAYMENT = 0,
|
||||||
ttCLAIM = 1,
|
ttCLAIM = 1, // open
|
||||||
ttWALLET_ADD = 2,
|
ttWALLET_ADD = 2,
|
||||||
ttACCOUNT_SET = 3,
|
ttACCOUNT_SET = 3,
|
||||||
ttPASSWORD_FUND = 4,
|
ttPASSWORD_FUND = 4, // open
|
||||||
ttPASSWORD_SET = 5,
|
ttREGULAR_KEY_SET = 5,
|
||||||
ttNICKNAME_SET = 6,
|
ttNICKNAME_SET = 6, // open
|
||||||
ttOFFER_CREATE = 7,
|
ttOFFER_CREATE = 7,
|
||||||
ttOFFER_CANCEL = 8,
|
ttOFFER_CANCEL = 8,
|
||||||
ttCONTRACT = 9,
|
ttCONTRACT = 9,
|
||||||
ttCONTRACT_REMOVE = 10, // can we use the same msg as offer cancel
|
ttCONTRACT_REMOVE = 10, // can we use the same msg as offer cancel
|
||||||
|
|
||||||
ttCREDIT_SET = 20,
|
ttTRUST_SET = 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
class TransactionFormat
|
class TransactionFormat
|
||||||
|
|||||||
Reference in New Issue
Block a user