mirror of
https://github.com/Xahau/xahaud.git
synced 2026-06-02 08:16:42 +00:00
ctid everywhere
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <ripple/rpc/CTID.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -59,10 +60,15 @@ Transaction::Transaction(
|
||||
//
|
||||
|
||||
void
|
||||
Transaction::setStatus(TransStatus ts, std::uint32_t lseq)
|
||||
Transaction::setStatus(TransStatus ts, std::uint32_t lseq,
|
||||
std::optional<std::uint32_t> tseq, std::optional<std::uint16_t> netID)
|
||||
{
|
||||
mStatus = ts;
|
||||
mInLedger = lseq;
|
||||
if (tseq)
|
||||
mTxnSeq = tseq;
|
||||
if (netID)
|
||||
mNetworkID = netID;
|
||||
}
|
||||
|
||||
TransStatus
|
||||
@@ -180,6 +186,20 @@ Transaction::getJson(JsonOptions options, bool binary) const
|
||||
if (ct)
|
||||
ret[jss::date] = ct->time_since_epoch().count();
|
||||
}
|
||||
|
||||
// compute outgoing CTID
|
||||
// override local network id if it's explicitly in the txn
|
||||
std::optional netID = mNetworkID;
|
||||
if (mTransaction->isFieldPresent(sfNetworkID))
|
||||
netID = mTransaction->getFieldU32(sfNetworkID);
|
||||
|
||||
if (mTxnSeq && netID && *mTxnSeq <= 0xFFFFU && *netID < 0xFFFFU && mInLedger < 0xFFFFFFFUL)
|
||||
{
|
||||
std::optional<std::string> ctid =
|
||||
RPC::encodeCTID(mInLedger, *mTxnSeq, *netID);
|
||||
if (ctid)
|
||||
ret[jss::ctid] = *ctid;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user