From 63ea3d6f22d28365d910c47c14ecf34c28dc0215 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 10 Jun 2012 16:15:33 -0700 Subject: [PATCH] Fix transaction load/save functions. --- src/Ledger.cpp | 2 +- src/SerializedTransaction.h | 2 ++ src/Transaction.h | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Ledger.cpp b/src/Ledger.cpp index 108757eeef..168c97cd56 100644 --- a/src/Ledger.cpp +++ b/src/Ledger.cpp @@ -294,7 +294,7 @@ void Ledger::saveAcceptedLedger(Ledger::pointer ledger) Log(lsTRACE) << "ActTx: " << sql; db->executeSQL(sql); db->executeSQL(txn.getSQLInsertHeader() + txn.getSQL(ledger->getLedgerSeq(), TXN_SQL_VALIDATED) + ";"); - // FIXME: If above updates no rows, modify seq/status + // FIXME: If above updates no rows, modify seq/status (upsert) } db->executeSQL("COMMIT TRANSACTION;"); } diff --git a/src/SerializedTransaction.h b/src/SerializedTransaction.h index ddb78a6997..2ec1bced89 100644 --- a/src/SerializedTransaction.h +++ b/src/SerializedTransaction.h @@ -14,6 +14,8 @@ #define TXN_SQL_CONFLICT 'C' #define TXN_SQL_HELD 'H' #define TXN_SQL_VALIDATED 'V' +#define TXN_SQL_INCLUDED 'I' +#define TXN_SQL_UNKNOWN 'U' class SerializedTransaction : public SerializedType { diff --git a/src/Transaction.h b/src/Transaction.h index 2510a04e64..c87b18d19d 100644 --- a/src/Transaction.h +++ b/src/Transaction.h @@ -248,10 +248,11 @@ public: void setStatus(TransStatus status, uint32 ledgerSeq); void setStatus(TransStatus status) { mStatus=status; } + void setLedger(uint32 ledger) { mInLedger = ledger; } // database functions static void saveTransaction(Transaction::pointer); - bool save() const; + bool save(); static Transaction::pointer load(const uint256& id); static Transaction::pointer findFrom(const NewcoinAddress& fromID, uint32 seq);