mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Update RPC, transactions, and ledger for new accountRootNode format.
This commit is contained in:
@@ -18,6 +18,8 @@ LedgerEntryFormat LedgerFormats[]=
|
||||
{ S_FIELD(MessageKey), STI_VL, SOE_IFFLAG, 8 },
|
||||
{ S_FIELD(TransferRate), STI_UINT32, SOE_IFFLAG, 16 },
|
||||
{ S_FIELD(Domain), STI_VL, SOE_IFFLAG, 32 },
|
||||
{ S_FIELD(PublishHash), STI_HASH256, SOE_IFFLAG, 64 },
|
||||
{ S_FIELD(PublishSize), STI_UINT32, SOE_IFFLAG, 128 },
|
||||
{ S_FIELD(Extensions), STI_TL, SOE_IFFLAG, 0x01000000 },
|
||||
{ sfInvalid, NULL, STI_DONE, SOE_NEVER, -1 } }
|
||||
},
|
||||
|
||||
@@ -414,6 +414,60 @@ Json::Value RPCServer::accountFromString(const uint256& uLedger, NewcoinAddress&
|
||||
return Json::Value(Json::objectValue);
|
||||
}
|
||||
|
||||
// account_domain_set <seed> <paying_account> [<domain>]
|
||||
Json::Value RPCServer::doAccountDomainSet(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
else if (!naSrcAccountID.setAccountID(params[1u].asString()))
|
||||
{
|
||||
return RPCError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
||||
|
||||
if (!obj.empty())
|
||||
return obj;
|
||||
|
||||
Transaction::pointer trans = Transaction::sharedAccountSet(
|
||||
naAccountPublic, naAccountPrivate,
|
||||
naSrcAccountID,
|
||||
asSrc->getSeq(),
|
||||
theConfig.FEE_DEFAULT,
|
||||
0, // YYY No source tag
|
||||
false,
|
||||
uint128(),
|
||||
false,
|
||||
0,
|
||||
NewcoinAddress(),
|
||||
true,
|
||||
strCopy(params[2u].asString()),
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
uint256(),
|
||||
0);
|
||||
|
||||
trans = mNetOps->submitTransaction(trans);
|
||||
|
||||
obj["transaction"] = trans->getSTransaction()->getJson(0);
|
||||
obj["status"] = trans->getStatus();
|
||||
|
||||
return Json::Value(Json::objectValue);
|
||||
}
|
||||
|
||||
// account_email_set <seed> <paying_account> [<email_address>]
|
||||
Json::Value RPCServer::doAccountEmailSet(const Json::Value ¶ms)
|
||||
{
|
||||
@@ -450,6 +504,7 @@ Json::Value RPCServer::doAccountEmailSet(const Json::Value ¶ms)
|
||||
MD5(reinterpret_cast<const unsigned char*>(strEmail.c_str()), strEmail.size(), &vucMD5.front());
|
||||
|
||||
uint128 uEmailHash(vucMD5);
|
||||
std::vector<unsigned char> vucDomain;
|
||||
|
||||
Transaction::pointer trans = Transaction::sharedAccountSet(
|
||||
naAccountPublic, naAccountPrivate,
|
||||
@@ -457,11 +512,18 @@ Json::Value RPCServer::doAccountEmailSet(const Json::Value ¶ms)
|
||||
asSrc->getSeq(),
|
||||
theConfig.FEE_DEFAULT,
|
||||
0, // YYY No source tag
|
||||
strEmail.empty(),
|
||||
uEmailHash,
|
||||
true,
|
||||
strEmail.empty() ? uint128() : uEmailHash,
|
||||
false,
|
||||
uint256(),
|
||||
NewcoinAddress());
|
||||
NewcoinAddress(),
|
||||
false,
|
||||
vucDomain,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
uint256(),
|
||||
0);
|
||||
|
||||
trans = mNetOps->submitTransaction(trans);
|
||||
|
||||
@@ -549,6 +611,62 @@ Json::Value RPCServer::doAccountMessageSet(const Json::Value& params) {
|
||||
return RPCError(rpcPUBLIC_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
||||
std::vector<unsigned char> vucDomain;
|
||||
|
||||
if (!obj.empty())
|
||||
return obj;
|
||||
|
||||
Transaction::pointer trans = Transaction::sharedAccountSet(
|
||||
naAccountPublic, naAccountPrivate,
|
||||
naSrcAccountID,
|
||||
asSrc->getSeq(),
|
||||
theConfig.FEE_DEFAULT,
|
||||
0, // YYY No source tag
|
||||
false,
|
||||
uint128(),
|
||||
false,
|
||||
uint256(),
|
||||
naMessagePubKey,
|
||||
false,
|
||||
vucDomain,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
uint256(),
|
||||
0);
|
||||
|
||||
trans = mNetOps->submitTransaction(trans);
|
||||
|
||||
obj["transaction"] = trans->getSTransaction()->getJson(0);
|
||||
obj["status"] = trans->getStatus();
|
||||
obj["MessageKey"] = naMessagePubKey.humanAccountPublic();
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
// account_publish_set <seed> <paying_account> <hash> <size>
|
||||
Json::Value RPCServer::doAccountPublishSet(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
else if (!naSrcAccountID.setAccountID(params[1u].asString()))
|
||||
{
|
||||
return RPCError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
@@ -560,6 +678,10 @@ Json::Value RPCServer::doAccountMessageSet(const Json::Value& params) {
|
||||
if (!obj.empty())
|
||||
return obj;
|
||||
|
||||
uint256 uPublishHash(params[2u].asString());
|
||||
uint32 uPublishSize = lexical_cast_s<int>(params[3u].asString());
|
||||
std::vector<unsigned char> vucDomain;
|
||||
|
||||
Transaction::pointer trans = Transaction::sharedAccountSet(
|
||||
naAccountPublic, naAccountPrivate,
|
||||
naSrcAccountID,
|
||||
@@ -569,16 +691,79 @@ Json::Value RPCServer::doAccountMessageSet(const Json::Value& params) {
|
||||
false,
|
||||
uint128(),
|
||||
false,
|
||||
uint256(),
|
||||
naMessagePubKey);
|
||||
0,
|
||||
NewcoinAddress(),
|
||||
false,
|
||||
vucDomain,
|
||||
false,
|
||||
0,
|
||||
true,
|
||||
uPublishHash,
|
||||
uPublishSize);
|
||||
|
||||
trans = mNetOps->submitTransaction(trans);
|
||||
|
||||
obj["transaction"] = trans->getSTransaction()->getJson(0);
|
||||
obj["status"] = trans->getStatus();
|
||||
obj["MessageKey"] = naMessagePubKey.humanAccountPublic();
|
||||
|
||||
return obj;
|
||||
return Json::Value(Json::objectValue);
|
||||
}
|
||||
|
||||
// account_rate_set <seed> <paying_account> <rate>
|
||||
Json::Value RPCServer::doAccountRateSet(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
else if (!naSrcAccountID.setAccountID(params[1u].asString()))
|
||||
{
|
||||
return RPCError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
||||
|
||||
if (!obj.empty())
|
||||
return obj;
|
||||
|
||||
uint32 uRate = lexical_cast_s<int>(params[2u].asString());
|
||||
std::vector<unsigned char> vucDomain;
|
||||
|
||||
Transaction::pointer trans = Transaction::sharedAccountSet(
|
||||
naAccountPublic, naAccountPrivate,
|
||||
naSrcAccountID,
|
||||
asSrc->getSeq(),
|
||||
theConfig.FEE_DEFAULT,
|
||||
0, // YYY No source tag
|
||||
false,
|
||||
uint128(),
|
||||
false,
|
||||
0,
|
||||
NewcoinAddress(),
|
||||
false,
|
||||
vucDomain,
|
||||
true,
|
||||
uRate,
|
||||
false,
|
||||
uint256(),
|
||||
0);
|
||||
|
||||
trans = mNetOps->submitTransaction(trans);
|
||||
|
||||
obj["transaction"] = trans->getSTransaction()->getJson(0);
|
||||
obj["status"] = trans->getStatus();
|
||||
|
||||
return Json::Value(Json::objectValue);
|
||||
}
|
||||
|
||||
// account_wallet_set <seed> <paying_account> [<wallet_hash>]
|
||||
@@ -596,21 +781,23 @@ Json::Value RPCServer::doAccountWalletSet(const Json::Value& params) {
|
||||
return RPCError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naMasterGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
NewcoinAddress naMasterGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
||||
std::vector<unsigned char> vucDomain;
|
||||
|
||||
if (!obj.empty())
|
||||
return obj;
|
||||
|
||||
std::string strWalletLocator = params.size() == 3 ? params[2u].asString() : "";
|
||||
uint256 uWalletLocator;
|
||||
std::string strWalletLocator = params.size() == 3 ? params[2u].asString() : "";
|
||||
uint256 uWalletLocator;
|
||||
|
||||
uWalletLocator.SetHex(strWalletLocator);
|
||||
if (!strWalletLocator.empty())
|
||||
uWalletLocator.SetHex(strWalletLocator);
|
||||
|
||||
Transaction::pointer trans = Transaction::sharedAccountSet(
|
||||
naAccountPublic, naAccountPrivate,
|
||||
@@ -620,9 +807,16 @@ Json::Value RPCServer::doAccountWalletSet(const Json::Value& params) {
|
||||
0, // YYY No source tag
|
||||
false,
|
||||
uint128(),
|
||||
strWalletLocator.empty(),
|
||||
true,
|
||||
uWalletLocator,
|
||||
NewcoinAddress());
|
||||
NewcoinAddress(),
|
||||
false,
|
||||
vucDomain,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
uint256(),
|
||||
0);
|
||||
|
||||
trans = mNetOps->submitTransaction(trans);
|
||||
|
||||
@@ -942,7 +1136,7 @@ Json::Value RPCServer::doOwnerInfo(const Json::Value& params)
|
||||
{
|
||||
std::string strIdent = params[0u].asString();
|
||||
bool bIndex;
|
||||
int iIndex = 2 == params.size()? lexical_cast_s<int>(params[1u].asString()) : 0;
|
||||
int iIndex = 2 == params.size() ? lexical_cast_s<int>(params[1u].asString()) : 0;
|
||||
NewcoinAddress naAccount;
|
||||
|
||||
Json::Value ret;
|
||||
@@ -2117,9 +2311,12 @@ Json::Value RPCServer::doCommand(const std::string& command, Json::Value& params
|
||||
bool mAdminRequired;
|
||||
unsigned int iOptions;
|
||||
} commandsA[] = {
|
||||
{ "account_domain_set", &RPCServer::doAccountDomainSet, 2, 3, false, optCurrent },
|
||||
{ "account_email_set", &RPCServer::doAccountEmailSet, 2, 3, false, optCurrent },
|
||||
{ "account_info", &RPCServer::doAccountInfo, 1, 2, false, optCurrent },
|
||||
{ "account_message_set", &RPCServer::doAccountMessageSet, 3, 3, false, optCurrent },
|
||||
{ "account_publish_set", &RPCServer::doAccountPublishSet, 4, 4, false, optCurrent },
|
||||
{ "account_rate_set", &RPCServer::doAccountRateSet, 3, 3, false, optCurrent },
|
||||
{ "account_tx", &RPCServer::doAccountTransactions, 2, 3, false, optNetwork },
|
||||
{ "account_wallet_set", &RPCServer::doAccountWalletSet, 2, 3, false, optCurrent },
|
||||
{ "connect", &RPCServer::doConnect, 1, 2, true },
|
||||
|
||||
@@ -125,9 +125,12 @@ private:
|
||||
|
||||
Json::Value accountFromString(const uint256& uLedger, NewcoinAddress& naAccount, bool& bIndex, const std::string& strIdent, const int iIndex);
|
||||
|
||||
Json::Value doAccountDomainSet(const Json::Value ¶ms);
|
||||
Json::Value doAccountEmailSet(const Json::Value ¶ms);
|
||||
Json::Value doAccountInfo(const Json::Value& params);
|
||||
Json::Value doAccountMessageSet(const Json::Value ¶ms);
|
||||
Json::Value doAccountPublishSet(const Json::Value ¶ms);
|
||||
Json::Value doAccountRateSet(const Json::Value ¶ms);
|
||||
Json::Value doAccountTransactions(const Json::Value& params);
|
||||
Json::Value doAccountWalletSet(const Json::Value ¶ms);
|
||||
Json::Value doConnect(const Json::Value& params);
|
||||
|
||||
@@ -85,6 +85,8 @@ enum SOE_Field
|
||||
sfPaths,
|
||||
sfPaysIssuer,
|
||||
sfPubKey,
|
||||
sfPublishHash,
|
||||
sfPublishSize,
|
||||
sfQualityIn,
|
||||
sfQualityOut,
|
||||
sfSendMax,
|
||||
|
||||
@@ -117,25 +117,41 @@ bool Transaction::sign(const NewcoinAddress& naAccountPrivate)
|
||||
|
||||
Transaction::pointer Transaction::setAccountSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
bool bUnsetEmailHash,
|
||||
bool bEmailHash,
|
||||
const uint128& uEmailHash,
|
||||
bool bUnsetWalletLocator,
|
||||
bool bWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const NewcoinAddress& naMessagePublic)
|
||||
const NewcoinAddress& naMessagePublic,
|
||||
bool bDomain,
|
||||
const std::vector<unsigned char>& vucDomain,
|
||||
bool bTransferRate,
|
||||
const uint32 uTransferRate,
|
||||
bool bPublish,
|
||||
const uint256& uPublishHash,
|
||||
const uint32 uPublishSize
|
||||
)
|
||||
{
|
||||
mTransaction->setITFieldU32(sfFlags,
|
||||
(bUnsetEmailHash ? tfUnsetEmailHash : 0)
|
||||
| (bUnsetWalletLocator ? tfUnsetWalletLocator : 0));
|
||||
|
||||
if (!bUnsetEmailHash && !!uEmailHash)
|
||||
if (!bEmailHash)
|
||||
mTransaction->setITFieldH128(sfEmailHash, uEmailHash);
|
||||
|
||||
if (!bUnsetWalletLocator && !!uWalletLocator)
|
||||
if (!bWalletLocator)
|
||||
mTransaction->setITFieldH256(sfWalletLocator, uWalletLocator);
|
||||
|
||||
if (naMessagePublic.isValid())
|
||||
mTransaction->setITFieldVL(sfMessageKey, naMessagePublic.getAccountPublic());
|
||||
|
||||
if (bDomain)
|
||||
mTransaction->setITFieldVL(sfDomain, vucDomain);
|
||||
|
||||
if (bTransferRate)
|
||||
mTransaction->setITFieldU32(sfTransferRate, uTransferRate);
|
||||
|
||||
if (bPublish)
|
||||
{
|
||||
mTransaction->setITFieldH256(sfPublishHash, uPublishHash);
|
||||
mTransaction->setITFieldU32(sfPublishSize, uPublishSize);
|
||||
}
|
||||
|
||||
sign(naPrivateKey);
|
||||
|
||||
return shared_from_this();
|
||||
@@ -147,15 +163,24 @@ Transaction::pointer Transaction::sharedAccountSet(
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
bool bUnsetEmailHash,
|
||||
bool bEmailHash,
|
||||
const uint128& uEmailHash,
|
||||
bool bUnsetWalletLocator,
|
||||
bool bWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const NewcoinAddress& naMessagePublic)
|
||||
const NewcoinAddress& naMessagePublic,
|
||||
bool bDomain,
|
||||
const std::vector<unsigned char>& vucDomain,
|
||||
bool bTransferRate,
|
||||
const uint32 uTransferRate,
|
||||
bool bPublish,
|
||||
const uint256& uPublishHash,
|
||||
const uint32 uPublishSize)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttACCOUNT_SET, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
||||
|
||||
return tResult->setAccountSet(naPrivateKey, bUnsetEmailHash, uEmailHash, bUnsetWalletLocator, uWalletLocator, naMessagePublic);
|
||||
return tResult->setAccountSet(naPrivateKey, bEmailHash, uEmailHash, bWalletLocator, uWalletLocator,
|
||||
naMessagePublic,
|
||||
bDomain, vucDomain, bTransferRate, uTransferRate, bPublish, uPublishHash, uPublishSize);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -48,11 +48,18 @@ private:
|
||||
|
||||
Transaction::pointer setAccountSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
bool bUnsetEmailHash,
|
||||
bool bEmailHash,
|
||||
const uint128& uEmailHash,
|
||||
bool bUnsetWalletLocator,
|
||||
bool bWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const NewcoinAddress& naMessagePublic);
|
||||
const NewcoinAddress& naMessagePublic,
|
||||
bool bDomain,
|
||||
const std::vector<unsigned char>& vucDomain,
|
||||
bool bTransferRate,
|
||||
const uint32 uTransferRate,
|
||||
bool bPublish,
|
||||
const uint256& uPublishHash,
|
||||
const uint32 uPublishSize);
|
||||
|
||||
Transaction::pointer setClaim(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
@@ -138,11 +145,18 @@ public:
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
bool bUnsetEmailHash,
|
||||
bool bEmailHash,
|
||||
const uint128& uEmailHash,
|
||||
bool bUnsetWalletLocator,
|
||||
bool bWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const NewcoinAddress& naMessagePublic);
|
||||
const NewcoinAddress& naMessagePublic,
|
||||
bool bDomain,
|
||||
const std::vector<unsigned char>& vucDomain,
|
||||
bool bTransferRate,
|
||||
const uint32 uTransferRate,
|
||||
bool bPublish,
|
||||
const uint256& uPublishHash,
|
||||
const uint32 uPublishSize);
|
||||
|
||||
// Claim a wallet.
|
||||
static Transaction::pointer sharedClaim(
|
||||
|
||||
@@ -36,6 +36,7 @@ bool transResultInfo(TransactionEngineResult terCode, std::string& strToken, std
|
||||
{ tenBAD_ISSUER, "tenBAD_ISSUER", "Malformed." },
|
||||
{ tenBAD_OFFER, "tenBAD_OFFER", "Malformed." },
|
||||
{ tenBAD_PATH_COUNT, "tenBAD_PATH_COUNT", "Malformed: too many paths." },
|
||||
{ tenBAD_PUBLISH, "tenBAD_PUBLISH", "Malformed: bad publish." },
|
||||
{ tenBAD_RIPPLE, "tenBAD_RIPPLE", "Ledger prevents ripple from succeeding." },
|
||||
{ tenBAD_SET_ID, "tenBAD_SET_ID", "Malformed." },
|
||||
{ tenCLAIMED, "tenCLAIMED", "Can not claim a previously claimed account." },
|
||||
@@ -1203,42 +1204,50 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
|
||||
|
||||
TransactionEngineResult TransactionEngine::doAccountSet(const SerializedTransaction& txn)
|
||||
{
|
||||
std::cerr << "doAccountSet>" << std::endl;
|
||||
|
||||
uint32 txFlags = txn.getFlags();
|
||||
Log(lsINFO) << "doAccountSet>";
|
||||
|
||||
//
|
||||
// EmailHash
|
||||
//
|
||||
|
||||
if (txFlags & tfUnsetEmailHash)
|
||||
if (txn.getITFieldPresent(sfEmailHash))
|
||||
{
|
||||
std::cerr << "doAccountSet: unset email hash" << std::endl;
|
||||
uint128 uHash = txn.getITFieldH128(sfEmailHash);
|
||||
|
||||
mTxnAccount->makeIFieldAbsent(sfEmailHash);
|
||||
}
|
||||
else if (txn.getITFieldPresent(sfEmailHash))
|
||||
{
|
||||
std::cerr << "doAccountSet: set email hash" << std::endl;
|
||||
if (uHash.isZero())
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: unset email hash";
|
||||
|
||||
mTxnAccount->setIFieldH128(sfEmailHash, txn.getITFieldH128(sfEmailHash));
|
||||
mTxnAccount->makeIFieldAbsent(sfEmailHash);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: set email hash";
|
||||
|
||||
mTxnAccount->setIFieldH128(sfEmailHash, uHash);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// WalletLocator
|
||||
//
|
||||
|
||||
if (txFlags & tfUnsetWalletLocator)
|
||||
if (txn.getITFieldPresent(sfWalletLocator))
|
||||
{
|
||||
std::cerr << "doAccountSet: unset wallet locator" << std::endl;
|
||||
uint256 uHash = txn.getITFieldH256(sfWalletLocator);
|
||||
|
||||
mTxnAccount->makeIFieldAbsent(sfWalletLocator);
|
||||
}
|
||||
else if (txn.getITFieldPresent(sfWalletLocator))
|
||||
{
|
||||
std::cerr << "doAccountSet: set wallet locator" << std::endl;
|
||||
if (uHash.isZero())
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: unset wallet locator";
|
||||
|
||||
mTxnAccount->setIFieldH256(sfWalletLocator, txn.getITFieldH256(sfWalletLocator));
|
||||
mTxnAccount->makeIFieldAbsent(sfEmailHash);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: set wallet locator";
|
||||
|
||||
mTxnAccount->setIFieldH256(sfWalletLocator, uHash);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1248,33 +1257,110 @@ TransactionEngineResult TransactionEngine::doAccountSet(const SerializedTransact
|
||||
if (!txn.getITFieldPresent(sfMessageKey))
|
||||
{
|
||||
nothing();
|
||||
|
||||
}
|
||||
else if (mTxnAccount->getIFieldPresent(sfMessageKey))
|
||||
{
|
||||
std::cerr << "doAccountSet: can not change message key" << std::endl;
|
||||
Log(lsINFO) << "doAccountSet: can not change message key";
|
||||
|
||||
return tenMSG_SET;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "doAccountSet: set message key" << std::endl;
|
||||
Log(lsINFO) << "doAccountSet: set message key";
|
||||
|
||||
mTxnAccount->setIFieldVL(sfMessageKey, txn.getITFieldVL(sfMessageKey));
|
||||
}
|
||||
|
||||
std::cerr << "doAccountSet<" << std::endl;
|
||||
//
|
||||
// Domain
|
||||
//
|
||||
|
||||
if (txn.getITFieldPresent(sfDomain))
|
||||
{
|
||||
std::vector<unsigned char> vucDomain = txn.getITFieldVL(sfDomain);
|
||||
|
||||
if (vucDomain.empty())
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: unset domain";
|
||||
|
||||
mTxnAccount->makeIFieldAbsent(sfDomain);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: set domain";
|
||||
|
||||
mTxnAccount->setIFieldVL(sfDomain, vucDomain);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TransferRate
|
||||
//
|
||||
|
||||
if (txn.getITFieldPresent(sfTransferRate))
|
||||
{
|
||||
uint32 uRate = txn.getITFieldU32(sfTransferRate);
|
||||
|
||||
if (!uRate)
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: unset transfer rate";
|
||||
|
||||
mTxnAccount->makeIFieldAbsent(sfTransferRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: set transfer rate";
|
||||
|
||||
mTxnAccount->setIFieldU32(sfTransferRate, uRate);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// PublishHash && PublishSize
|
||||
//
|
||||
|
||||
bool bPublishHash = txn.getITFieldPresent(sfPublishHash);
|
||||
bool bPublishSize = txn.getITFieldPresent(sfPublishSize);
|
||||
|
||||
if (bPublishHash ^ bPublishSize)
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: bad publish";
|
||||
|
||||
return tenBAD_PUBLISH;
|
||||
}
|
||||
else if (bPublishHash && bPublishSize)
|
||||
{
|
||||
uint256 uHash = txn.getITFieldH256(sfPublishHash);
|
||||
uint32 uSize = txn.getITFieldU32(sfPublishSize);
|
||||
|
||||
if (uHash.isZero())
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: unset publish";
|
||||
|
||||
mTxnAccount->makeIFieldAbsent(sfPublishHash);
|
||||
mTxnAccount->makeIFieldAbsent(sfPublishSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "doAccountSet: set publish";
|
||||
|
||||
mTxnAccount->setIFieldH256(sfPublishHash, uHash);
|
||||
mTxnAccount->setIFieldU32(sfPublishSize, uSize);
|
||||
}
|
||||
}
|
||||
|
||||
Log(lsINFO) << "doAccountSet<";
|
||||
|
||||
return terSUCCESS;
|
||||
}
|
||||
|
||||
TransactionEngineResult TransactionEngine::doClaim(const SerializedTransaction& txn)
|
||||
{
|
||||
std::cerr << "doClaim>" << std::endl;
|
||||
Log(lsINFO) << "doClaim>";
|
||||
|
||||
TransactionEngineResult terResult = setAuthorized(txn, true);
|
||||
|
||||
std::cerr << "doClaim<" << std::endl;
|
||||
Log(lsINFO) << "doClaim<";
|
||||
|
||||
return terResult;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ enum TransactionEngineResult
|
||||
tenBAD_ISSUER,
|
||||
tenBAD_OFFER,
|
||||
tenBAD_PATH_COUNT,
|
||||
tenBAD_PUBLISH,
|
||||
tenBAD_SET_ID,
|
||||
tenCREATEXNS,
|
||||
tenDST_IS_SRC,
|
||||
|
||||
@@ -12,6 +12,9 @@ TransactionFormat InnerTxnFormats[]=
|
||||
{ S_FIELD(WalletLocator), STI_HASH256, SOE_IFFLAG, 4 },
|
||||
{ S_FIELD(MessageKey), STI_VL, SOE_IFFLAG, 8 },
|
||||
{ S_FIELD(Domain), STI_VL, SOE_IFFLAG, 16 },
|
||||
{ S_FIELD(TransferRate), STI_UINT32, SOE_IFFLAG, 32 },
|
||||
{ S_FIELD(PublishHash), STI_HASH256, SOE_IFFLAG, 64 },
|
||||
{ S_FIELD(PublishSize), STI_UINT32, SOE_IFFLAG, 128 },
|
||||
{ S_FIELD(Extensions), STI_TL, SOE_IFFLAG, 0x02000000 },
|
||||
{ sfInvalid, NULL, STI_DONE, SOE_NEVER, -1 } }
|
||||
},
|
||||
|
||||
@@ -39,10 +39,6 @@ const int TransactionMaxLen = 1048576;
|
||||
// Transaction flags.
|
||||
//
|
||||
|
||||
// AccountSet flags:
|
||||
const uint32 tfUnsetEmailHash = 0x00010000;
|
||||
const uint32 tfUnsetWalletLocator = 0x00020000;
|
||||
|
||||
// OfferCreate flags:
|
||||
const uint32 tfPassive = 0x00010000;
|
||||
|
||||
|
||||
@@ -38,10 +38,13 @@ void printHelp(const po::options_description& desc)
|
||||
cout << desc << endl;
|
||||
|
||||
cout << "Commands: " << endl;
|
||||
cout << " account_domain_set <seed> <paying_account> [<domain>]" << endl;
|
||||
cout << " account_email_set <seed> <paying_account> [<email_address>]" << endl;
|
||||
cout << " account_info <account>|<nickname>" << endl;
|
||||
cout << " account_info <seed>|<pass_phrase>|<key> [<index>]" << endl;
|
||||
cout << " account_message_set <seed> <paying_account> <pub_key>" << endl;
|
||||
cout << " account_publish_set <seed> <paying_account> <hash> <size>" << endl;
|
||||
cout << " account_rate_set <seed> <paying_account> <rate>" << endl;
|
||||
cout << " account_wallet_set <seed> <paying_account> [<wallet_hash>]" << endl;
|
||||
cout << " connect <ip> [<port>]" << endl;
|
||||
cout << " data_delete <key>" << endl;
|
||||
|
||||
Reference in New Issue
Block a user