mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
jtx: Allow disabling of sig checks
This commit is contained in:
committed by
Edward Hennis
parent
e1fc81f66f
commit
dd94de2830
@@ -233,11 +233,18 @@ public:
|
|||||||
|
|
||||||
/** Turn off testing. */
|
/** Turn off testing. */
|
||||||
void
|
void
|
||||||
disable_testing ()
|
disable_testing()
|
||||||
{
|
{
|
||||||
testing_ = false;
|
testing_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Turn off signature checks. */
|
||||||
|
void
|
||||||
|
disable_sigs()
|
||||||
|
{
|
||||||
|
nosig_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
/** Associate AccountID with account. */
|
/** Associate AccountID with account. */
|
||||||
void
|
void
|
||||||
memoize (Account const& account);
|
memoize (Account const& account);
|
||||||
@@ -463,6 +470,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
int trace_ = 0;
|
int trace_ = 0;
|
||||||
bool testing_ = true;
|
bool testing_ = true;
|
||||||
|
bool nosig_ = false;
|
||||||
TestStopwatch stopwatch_;
|
TestStopwatch stopwatch_;
|
||||||
uint256 txid_;
|
uint256 txid_;
|
||||||
|
|
||||||
|
|||||||
@@ -86,17 +86,7 @@ Env::close(NetClock::time_point const& closeTime)
|
|||||||
open_ledger, *closed_,
|
open_ledger, *closed_,
|
||||||
app().timeKeeper().closeTime());
|
app().timeKeeper().closeTime());
|
||||||
next->setClosed();
|
next->setClosed();
|
||||||
#if 0
|
std::vector<std::shared_ptr<STTx const>> txs;
|
||||||
// Build a SHAMap, put all the transactions
|
|
||||||
// in it, and calculate the hash of the SHAMap
|
|
||||||
// to construct the OrderedTxs
|
|
||||||
SHAMap sm;
|
|
||||||
OrderedTxs txs(sm.getRootHash());
|
|
||||||
...
|
|
||||||
#else
|
|
||||||
std::vector<std::shared_ptr<
|
|
||||||
STTx const>> txs;
|
|
||||||
#endif
|
|
||||||
auto cur = openLedger.current();
|
auto cur = openLedger.current();
|
||||||
for (auto iter = cur->txs.begin();
|
for (auto iter = cur->txs.begin();
|
||||||
iter != cur->txs.end(); ++iter)
|
iter != cur->txs.end(); ++iter)
|
||||||
@@ -311,18 +301,25 @@ Env::autofill_sig (JTx& jt)
|
|||||||
{
|
{
|
||||||
auto& jv = jt.jv;
|
auto& jv = jt.jv;
|
||||||
if (jt.signer)
|
if (jt.signer)
|
||||||
jt.signer(*this, jt);
|
return jt.signer(*this, jt);
|
||||||
else if(jt.fill_sig)
|
if (! jt.fill_sig)
|
||||||
|
return;
|
||||||
|
auto const account =
|
||||||
|
lookup(jv[jss::Account].asString());
|
||||||
|
if (nosig_)
|
||||||
{
|
{
|
||||||
auto const account =
|
jv[jss::SigningPubKey] =
|
||||||
lookup(jv[jss::Account].asString());
|
strHex(account.pk().slice());
|
||||||
auto const ar = le(account);
|
// dummy sig otherwise STTx is invalid
|
||||||
if (ar && ar->isFieldPresent(sfRegularKey))
|
jv[jss::TxnSignature] = "00";
|
||||||
jtx::sign(jv, lookup(
|
return;
|
||||||
ar->getAccountID(sfRegularKey)));
|
|
||||||
else
|
|
||||||
jtx::sign(jv, account);
|
|
||||||
}
|
}
|
||||||
|
auto const ar = le(account);
|
||||||
|
if (ar && ar->isFieldPresent(sfRegularKey))
|
||||||
|
jtx::sign(jv, lookup(
|
||||||
|
ar->getAccountID(sfRegularKey)));
|
||||||
|
else
|
||||||
|
jtx::sign(jv, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -379,9 +376,12 @@ Env::st (JTx const& jt)
|
|||||||
ApplyFlags
|
ApplyFlags
|
||||||
Env::applyFlags() const
|
Env::applyFlags() const
|
||||||
{
|
{
|
||||||
|
ApplyFlags flags = tapNONE;
|
||||||
if (testing_)
|
if (testing_)
|
||||||
return tapENABLE_TESTING;
|
flags = flags | tapENABLE_TESTING;
|
||||||
return tapNONE;
|
if (nosig_)
|
||||||
|
flags = flags | tapNO_CHECK_SIGN;
|
||||||
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // jtx
|
} // jtx
|
||||||
|
|||||||
Reference in New Issue
Block a user