mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Get RPC command account_message_set working.
This commit is contained in:
@@ -390,7 +390,7 @@ Json::Value RPCServer::doAccountEmailSet(Json::Value ¶ms)
|
||||
uEmailHash,
|
||||
false,
|
||||
uint256(),
|
||||
std::vector<unsigned char>());
|
||||
NewcoinAddress());
|
||||
|
||||
(void) mNetOps->processTransaction(trans);
|
||||
|
||||
@@ -560,6 +560,7 @@ Json::Value RPCServer::doAccountMessageSet(Json::Value& params) {
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger;
|
||||
NewcoinAddress naMessagePubKey;
|
||||
|
||||
if (params.size() != 3)
|
||||
{
|
||||
@@ -573,6 +574,10 @@ Json::Value RPCServer::doAccountMessageSet(Json::Value& params) {
|
||||
{
|
||||
return "source account id needed";
|
||||
}
|
||||
else if (!naMessagePubKey.setAccountPublic(params[2u].asString()))
|
||||
{
|
||||
return "public key needed";
|
||||
}
|
||||
else if (!mNetOps->available())
|
||||
{
|
||||
return JSONRPCError(503, "network not available");
|
||||
@@ -599,8 +604,6 @@ Json::Value RPCServer::doAccountMessageSet(Json::Value& params) {
|
||||
return JSONRPCError(500, "insufficent funds");
|
||||
}
|
||||
|
||||
std::string strMessageKey = params[2u].asString();
|
||||
|
||||
Transaction::pointer trans = Transaction::sharedAccountSet(
|
||||
naAccountPublic, naAccountPrivate,
|
||||
naSrcAccountID,
|
||||
@@ -611,13 +614,13 @@ Json::Value RPCServer::doAccountMessageSet(Json::Value& params) {
|
||||
uint128(),
|
||||
false,
|
||||
uint256(),
|
||||
std::vector<unsigned char>());
|
||||
naMessagePubKey);
|
||||
|
||||
(void) mNetOps->processTransaction(trans);
|
||||
|
||||
obj["transaction"] = trans->getSTransaction()->getJson(0);
|
||||
obj["status"] = trans->getStatus();
|
||||
// ret["MessageKey"] = strHex(vucMessageKey);
|
||||
obj["MessageKey"] = naMessagePubKey.humanAccountPublic();
|
||||
|
||||
return obj;
|
||||
}
|
||||
@@ -681,7 +684,7 @@ Json::Value RPCServer::doAccountWalletSet(Json::Value& params) {
|
||||
uint128(),
|
||||
strWalletLocator.empty(),
|
||||
uWalletLocator,
|
||||
std::vector<unsigned char>());
|
||||
NewcoinAddress());
|
||||
|
||||
(void) mNetOps->processTransaction(trans);
|
||||
|
||||
@@ -1506,11 +1509,20 @@ Json::Value RPCServer::doWalletPropose(Json::Value& params)
|
||||
naGenerator.setFamilyGenerator(naSeed);
|
||||
naAccount.setAccountPublic(naGenerator, 0);
|
||||
|
||||
//
|
||||
// Extra functionality: generate a key pair
|
||||
//
|
||||
CKey key;
|
||||
|
||||
key.MakeNewKey();
|
||||
|
||||
Json::Value obj(Json::objectValue);
|
||||
|
||||
obj["master_seed"] = naSeed.humanFamilySeed();
|
||||
obj["master_key"] = naSeed.humanFamilySeed1751();
|
||||
obj["account_id"] = naAccount.humanAccountID();
|
||||
obj["extra_public"] = NewcoinAddress::createHumanAccountPublic(key.GetPubKey());
|
||||
obj["extra_private"] = NewcoinAddress::createHumanAccountPrivate(key.GetSecret());
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ Transaction::pointer Transaction::setAccountSet(
|
||||
const uint128& uEmailHash,
|
||||
bool bUnsetWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const std::vector<unsigned char>& vucPubKey)
|
||||
const NewcoinAddress& naMessagePublic)
|
||||
{
|
||||
mTransaction->setITFieldU32(sfFlags,
|
||||
(bUnsetEmailHash ? tfUnsetEmailHash : 0)
|
||||
@@ -134,8 +134,8 @@ Transaction::pointer Transaction::setAccountSet(
|
||||
if (!bUnsetWalletLocator && !!uWalletLocator)
|
||||
mTransaction->setITFieldH256(sfWalletLocator, uWalletLocator);
|
||||
|
||||
if (!vucPubKey.empty())
|
||||
mTransaction->setITFieldVL(sfMessageKey, vucPubKey);
|
||||
if (naMessagePublic.isValid())
|
||||
mTransaction->setITFieldVL(sfMessageKey, naMessagePublic.getAccountPublic());
|
||||
|
||||
sign(naPrivateKey);
|
||||
|
||||
@@ -152,11 +152,11 @@ Transaction::pointer Transaction::sharedAccountSet(
|
||||
const uint128& uEmailHash,
|
||||
bool bUnsetWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const std::vector<unsigned char>& vucPubKey)
|
||||
const NewcoinAddress& naMessagePublic)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttACCOUNT_SET, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
||||
|
||||
return tResult->setAccountSet(naPrivateKey, bUnsetEmailHash, uEmailHash, bUnsetWalletLocator, uWalletLocator, vucPubKey);
|
||||
return tResult->setAccountSet(naPrivateKey, bUnsetEmailHash, uEmailHash, bUnsetWalletLocator, uWalletLocator, naMessagePublic);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -52,7 +52,7 @@ private:
|
||||
const uint128& uEmailHash,
|
||||
bool bUnsetWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const std::vector<unsigned char>& vucPubKey);
|
||||
const NewcoinAddress& naMessagePublic);
|
||||
|
||||
Transaction::pointer setClaim(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
const uint128& uEmailHash,
|
||||
bool bUnsetWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const std::vector<unsigned char>& vucPubKey);
|
||||
const NewcoinAddress& naMessagePublic);
|
||||
|
||||
// Claim a wallet.
|
||||
static Transaction::pointer sharedClaim(
|
||||
|
||||
Reference in New Issue
Block a user