forward porting part 1

This commit is contained in:
Richard Holland
2022-01-11 13:33:23 +00:00
parent 3697f7b69c
commit ec22906e78
6 changed files with 26 additions and 27 deletions

View File

@@ -6,6 +6,8 @@ endif ()
project (rippled)
set(Boost_NO_BOOST_CMAKE ON)
# make GIT_COMMIT_HASH define available to all sources
find_package(Git)
if(Git_FOUND)

View File

@@ -1440,8 +1440,7 @@ TxQ::accept(Application& app, OpenView& view)
emittedDirKeylet.key,
sleDirNode,
uDirEntry,
dirEntry,
j_))
dirEntry))
break;
do
@@ -1549,7 +1548,7 @@ TxQ::accept(Application& app, OpenView& view)
JLOG(j_.fatal()) << "EmittedTxn Processing: Failure: " << e.what() << "\n";
}
} while (cdirNext(view, emittedDirKeylet.key, sleDirNode, uDirEntry, dirEntry, j_));
} while (cdirNext(view, emittedDirKeylet.key, sleDirNode, uDirEntry, dirEntry));
} while(0);

View File

@@ -1,3 +1,5 @@
#ifndef APPLY_HOOK_INCLUDED
#define APPLY_HOOK_INCLUDED
#include <ripple/basics/Blob.h>
#include <ripple/protocol/TER.h>
#include <ripple/app/tx/impl/ApplyContext.h>
@@ -552,4 +554,4 @@ namespace hook {
}
#endif

View File

@@ -1210,8 +1210,7 @@ SetHook::destroyNamespace(
dirKeylet.key,
sleDirNode,
uDirEntry,
dirEntry,
ctx.j)) {
dirEntry)) {
JLOG(ctx.j.fatal())
<< "HookSet[" << HS_ACC() << "]: DeleteState "
<< "account directory missing " << account;
@@ -1252,8 +1251,7 @@ SetHook::destroyNamespace(
}
} while (cdirNext(
view, dirKeylet.key, sleDirNode, uDirEntry, dirEntry, ctx.j));
} while (cdirNext(view, dirKeylet.key, sleDirNode, uDirEntry, dirEntry));
return tesSUCCESS;
}
@@ -1290,13 +1288,10 @@ SetHook::destroyNamespace(
if (!newDirSLE)\
{\
newDirSLE = std::make_shared<SLE>(*newDirKeylet);\
auto const page = dirAdd(\
view(),\
auto const page = view().dirInsert(\
ownerDirKeylet,\
newDirKeylet->key,\
false,\
describeOwnerDir(account_),\
ctx.j);\
describeOwnerDir(account_));\
JLOG(ctx.j.trace()) << "Create state dir for account " << toBase58(account_)\
<< ": " << (page ? "success" : "failure");\
if (!page)\

View File

@@ -392,18 +392,18 @@ Transactor::checkSeqProxy(
SeqProxy const a_seq = SeqProxy::sequence((*sle)[sfSequence]);
// pass all emitted tx provided their seq is 0
if (ctx.view.rules().enabled(featureHooks) &&
hook::isEmittedTxn(ctx.tx))
if (view.rules().enabled(featureHooks) &&
hook::isEmittedTxn(tx))
{
// this is more strictly enforced in the emit() hook api
// here this is only acting as a sanity check in case of bugs
if (!ctx.tx.isFieldPresent(sfFirstLedgerSequence))
if (!tx.isFieldPresent(sfFirstLedgerSequence))
return tefINTERNAL;
return tesSUCCESS;
}
// reserved for emitted tx only at this time
if (ctx.tx.isFieldPresent(sfFirstLedgerSequence))
if (tx.isFieldPresent(sfFirstLedgerSequence))
return tefINTERNAL;
if (t_seqProx.isSeq())
@@ -495,7 +495,7 @@ Transactor::consumeSeqProxy(SLE::pointer const& sleAccount)
// RH TODO: determine what interactions between hooks and tickets might cause issues
// do not update sequence of sfAccountTxnID for emitted tx
if (ctx_.emitted())
return;
return tesSUCCESS;
SeqProxy const seqProx = ctx_.tx.getSeqProxy();
if (seqProx.isSeq())

View File

@@ -514,13 +514,10 @@ hook::setHookState(
if (!oldHookState) {
// Add the hook to the account's directory if it wasn't there already
auto const page = dirAdd(
view,
auto const page = view.dirInsert(
hookStateDirKeylet,
hookStateKeylet.key,
false,
describeOwnerDir(acc),
j);
describeOwnerDir(acc));
JLOG(j.trace()) << "HookInfo[" << HR_ACC() << "]: "
<< "Create/update hook state: "
@@ -1686,15 +1683,19 @@ DEFINE_HOOK_FUNCTION(
{
uint256 hash;
if (!hash.SetHexExact((const char*)(memory + read_ptr)))
if (!hash.parseHex((const char*)(memory + read_ptr)))
return INVALID_ARGUMENT;
ripple::error_code_i ec { ripple::error_code_i::rpcUNKNOWN };
std::shared_ptr<ripple::Transaction> hTx = applyCtx.app.getMasterTransaction().fetch(hash, ec);
if (!hTx)
auto hTx = applyCtx.app.getMasterTransaction().fetch(hash, ec);
if (!std::holds_alternative<
std::pair<std::shared_ptr<ripple::Transaction>, std::shared_ptr<ripple::TxMeta>>>>(hTx))
return DOESNT_EXIST;
slot_value = hTx->getSTransaction();
slot_value = std::get<std::pair<std::shared_ptr<ripple::Transaction>, std::shared_ptr<ripple::TxMeta>>>(hTx)
.first->getSTransaction();
}
else
return DOESNT_EXIST;