NotTEC Transactor::checkSeq (PreclaimContext const& ctx) { auto const id = ctx.tx.getAccountID(sfAccount); auto const sle = ctx.view.read( keylet::account(id)); if (!sle) { JLOG(ctx.j.trace()) << "applyTransaction: delay: source account does not exist " << toBase58(ctx.tx.getAccountID(sfAccount)); return terNO_ACCOUNT; } std::uint32_t const t_seq = ctx.tx.getSequence (); std::uint32_t const a_seq = sle->getFieldU32 (sfSequence); if (t_seq != a_seq) { if (a_seq < t_seq) { JLOG(ctx.j.trace()) << "applyTransaction: has future sequence number " << "a_seq=" << a_seq << " t_seq=" << t_seq; return terPRE_SEQ; } if (ctx.view.txExists(ctx.tx.getTransactionID ())) return tefALREADY; JLOG(ctx.j.trace()) << "applyTransaction: has past sequence number " << "a_seq=" << a_seq << " t_seq=" << t_seq; return tefPAST_SEQ; } if (ctx.tx.isFieldPresent (sfAccountTxnID) && (sle->getFieldH256 (sfAccountTxnID) != ctx.tx.getFieldH256 (sfAccountTxnID))) return tefWRONG_PRIOR; if (ctx.tx.isFieldPresent (sfLastLedgerSequence) && (ctx.view.seq() > ctx.tx.getFieldU32 (sfLastLedgerSequence))) return tefMAX_LEDGER; return tesSUCCESS; }
bool SerializedLedgerEntry::thread (uint256 const& txID, uint32 ledgerSeq, uint256& prevTxID, uint32& prevLedgerID) { uint256 oldPrevTxID = getFieldH256 (sfPreviousTxnID); WriteLog (lsTRACE, SerializedLedgerLog) << "Thread Tx:" << txID << " prev:" << oldPrevTxID; if (oldPrevTxID == txID) { // this transaction is already threaded assert (getFieldU32 (sfPreviousTxnLgrSeq) == ledgerSeq); return false; } prevTxID = oldPrevTxID; prevLedgerID = getFieldU32 (sfPreviousTxnLgrSeq); setFieldH256 (sfPreviousTxnID, txID); setFieldU32 (sfPreviousTxnLgrSeq, ledgerSeq); return true; }
bool STLedgerEntry::thread (uint256 const& txID, std::uint32_t ledgerSeq, uint256& prevTxID, std::uint32_t& prevLedgerID) { uint256 oldPrevTxID = getFieldH256 (sfPreviousTxnID); JLOG (debugLog().info()) << "Thread Tx:" << txID << " prev:" << oldPrevTxID; if (oldPrevTxID == txID) { // this transaction is already threaded assert (getFieldU32 (sfPreviousTxnLgrSeq) == ledgerSeq); return false; } prevTxID = oldPrevTxID; prevLedgerID = getFieldU32 (sfPreviousTxnLgrSeq); setFieldH256 (sfPreviousTxnID, txID); setFieldU32 (sfPreviousTxnLgrSeq, ledgerSeq); return true; }
uint256 STLedgerEntry::getThreadedTransaction () const { return getFieldH256 (sfPreviousTxnID); }
uint256 STValidation::getConsensusHash () const { return getFieldH256 (sfConsensusHash); }
uint256 STValidation::getLedgerHash () const { return getFieldH256 (sfLedgerHash); }
uint256 SerializedLedgerEntry::getThreadedTransaction () { return getFieldH256 (sfPreviousTxnID); }