mirror of
https://github.com/Xahau/xahaud.git
synced 2026-08-23 00:10:54 +00:00
fix: correct xport api signature and sfExportedTxn type usage
- Fix xport hook API whitelist to declare 4 args (I32, I32, I32, I32) instead of 2, matching the actual implementation signature - Fix TxQ.cpp to use emplace_back with STObject for sfExportedTxn instead of setFieldVL, since sfExportedTxn is OBJECT type not VL. The previous code would throw "Wrong field type" at runtime.
This commit is contained in:
@@ -480,7 +480,7 @@ static const APIWhitelist import_whitelist_1{
|
||||
//@@start import-whitelist-2
|
||||
static const APIWhitelist import_whitelist_2{
|
||||
// clang-format off
|
||||
HOOK_API_DEFINITION(I64, xport, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, xport, (I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, xport_reserve, (I32)),
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@@ -1683,10 +1683,17 @@ TxQ::accept(Application& app, OpenView& view)
|
||||
|
||||
stpTrans->setFieldArray(sfSigners, signers);
|
||||
|
||||
Blob const& blob = stpTrans->getSerializer().peekData();
|
||||
// Serialize the inner transaction and create an
|
||||
// STObject from it. sfExportedTxn is OBJECT type, not
|
||||
// VL, so we must use emplace_back with STObject, not
|
||||
// setFieldVL.
|
||||
ripple::Serializer exportedSer;
|
||||
stpTrans->add(exportedSer);
|
||||
SerialIter exportedSit(exportedSer.slice());
|
||||
|
||||
STTx exportTx(ttEXPORT, [&](auto& obj) {
|
||||
obj.setFieldVL(sfExportedTxn, blob);
|
||||
obj.emplace_back(
|
||||
ripple::STObject(exportedSit, sfExportedTxn));
|
||||
obj.setFieldU32(sfLedgerSequence, seq);
|
||||
obj.setFieldH256(sfTransactionHash, txnHash);
|
||||
obj.setFieldArray(sfSigners, signers);
|
||||
|
||||
Reference in New Issue
Block a user