mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 11:35:53 +00:00
Implement clearing the regular key, setting and clearing the no master
flag and enforcing the no master flag.
This commit is contained in:
@@ -105,6 +105,34 @@ TER AccountSetTransactor::doApply ()
|
||||
uFlagsOut &= ~lsfDisallowXRP;
|
||||
}
|
||||
|
||||
//
|
||||
// DisableMaster
|
||||
//
|
||||
|
||||
if ((tfDisableMaster | tfEnableMaster) == (uTxFlags & (tfDisableMaster | tfEnableMaster)))
|
||||
{
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Malformed transaction: Contradictory flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
|
||||
if ((uTxFlags & tfDisableMaster) && !isSetBit (uFlagsIn, lsfDisableMaster))
|
||||
{
|
||||
if (!mTxnAccount->isFieldPresent (sfRegularKey))
|
||||
return tefNO_REGULAR_KEY;
|
||||
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Set lsfDisableMaster.";
|
||||
|
||||
uFlagsOut |= lsfDisableMaster;
|
||||
}
|
||||
|
||||
if ((uTxFlags & tfEnableMaster) && isSetBit (uFlagsIn, lsfDisableMaster))
|
||||
{
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Clear lsfDisableMaster.";
|
||||
|
||||
uFlagsOut &= ~lsfDisableMaster;
|
||||
}
|
||||
|
||||
//
|
||||
// EmailHash
|
||||
//
|
||||
|
||||
@@ -38,8 +38,17 @@ TER RegularKeySetTransactor::doApply ()
|
||||
mTxnAccount->setFlag (lsfPasswordSpent);
|
||||
}
|
||||
|
||||
uint160 uAuthKeyID = mTxn.getFieldAccount160 (sfRegularKey);
|
||||
mTxnAccount->setFieldAccount (sfRegularKey, uAuthKeyID);
|
||||
if (mTxn.isFieldPresent (sfRegularKey))
|
||||
{
|
||||
uint160 uAuthKeyID = mTxn.getFieldAccount160 (sfRegularKey);
|
||||
mTxnAccount->setFieldAccount (sfRegularKey, uAuthKeyID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mTxnAccount->isFlag (lsfDisableMaster))
|
||||
return tefMASTER_DISABLED;
|
||||
mTxnAccount->makeFieldAbsent (sfRegularKey);
|
||||
}
|
||||
|
||||
std::cerr << "RegularKeySet<" << std::endl;
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ UPTR_T<Transactor> Transactor::makeTransactor (const SerializedTransaction& txn,
|
||||
Transactor::Transactor (const SerializedTransaction& txn, TransactionEngineParams params, TransactionEngine* engine) : mTxn (txn), mEngine (engine), mParams (params)
|
||||
{
|
||||
mHasAuthKey = false;
|
||||
mSigMaster = false;
|
||||
}
|
||||
|
||||
void Transactor::calculateFee ()
|
||||
@@ -101,12 +102,14 @@ TER Transactor::checkSig ()
|
||||
{
|
||||
// Consistency: Check signature
|
||||
// Verify the transaction's signing public key is the key authorized for signing.
|
||||
if (mHasAuthKey && mSigningPubKey.getAccountID () == mTxnAccount->getFieldAccount160 (sfRegularKey))
|
||||
if (mSigningPubKey.getAccountID () == mTxnAccountID)
|
||||
{
|
||||
// Authorized to continue.
|
||||
nothing ();
|
||||
mSigMaster = true;
|
||||
if (mTxnAccount->isFlag(lsfDisableMaster))
|
||||
return tefMASTER_DISABLED;
|
||||
}
|
||||
else if (mSigningPubKey.getAccountID () == mTxnAccountID)
|
||||
else if (mHasAuthKey && mSigningPubKey.getAccountID () == mTxnAccount->getFieldAccount160 (sfRegularKey))
|
||||
{
|
||||
// Authorized to continue.
|
||||
nothing ();
|
||||
|
||||
@@ -29,6 +29,7 @@ protected:
|
||||
STAmount mSourceBalance; // Balance after fees.
|
||||
SLE::pointer mTxnAccount;
|
||||
bool mHasAuthKey;
|
||||
bool mSigMaster;
|
||||
RippleAddress mSigningPubKey;
|
||||
|
||||
virtual TER preCheck ();
|
||||
|
||||
Reference in New Issue
Block a user