mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -279,6 +279,14 @@ SqliteStatement::SqliteStatement(SqliteDatabase* db, const char *sql)
|
||||
throw j;
|
||||
}
|
||||
|
||||
SqliteStatement::SqliteStatement(SqliteDatabase* db, const std::string& sql)
|
||||
{
|
||||
assert(db);
|
||||
int j = sqlite3_prepare_v2(db->peekConnection(), sql.c_str(), sql.size() + 1, &statement, NULL);
|
||||
if (j != SQLITE_OK)
|
||||
throw j;
|
||||
}
|
||||
|
||||
SqliteStatement::~SqliteStatement()
|
||||
{
|
||||
sqlite3_finalize(statement);
|
||||
|
||||
@@ -73,6 +73,7 @@ protected:
|
||||
|
||||
public:
|
||||
SqliteStatement(SqliteDatabase* db, const char *statement);
|
||||
SqliteStatement(SqliteDatabase* db, const std::string& statement);
|
||||
~SqliteStatement();
|
||||
|
||||
sqlite3_stmt* peekStatement();
|
||||
|
||||
@@ -105,7 +105,9 @@ STAmount STAmount::addRound(const STAmount& v1, const STAmount& v2, bool roundUp
|
||||
}
|
||||
|
||||
int64 fv = vv1 + vv2;
|
||||
if (fv >= 0)
|
||||
if ((fv >= -10) && (fv <= -10))
|
||||
return STAmount(v1.getFName(), v1.mCurrency, v1.mIssuer);
|
||||
else if (fv >= 0)
|
||||
{
|
||||
uint64 v = static_cast<uint64>(fv);
|
||||
canonicalizeRound(false, v, ov1, roundUp);
|
||||
@@ -168,7 +170,9 @@ STAmount STAmount::subRound(const STAmount& v1, const STAmount& v2, bool roundUp
|
||||
}
|
||||
|
||||
int64 fv = vv1 + vv2;
|
||||
if (fv >= 0)
|
||||
if ((fv >= -10) && (fv <= -10))
|
||||
return STAmount(v1.getFName(), v1.mCurrency, v1.mIssuer);
|
||||
else if (fv >= 0)
|
||||
{
|
||||
uint64 v = static_cast<uint64>(fv);
|
||||
canonicalizeRound(false, v, ov1, roundUp);
|
||||
|
||||
@@ -183,12 +183,13 @@ HashedObject::pointer HashedObjectStore::retrieve(const uint256& hash)
|
||||
|
||||
#ifndef NO_SQLITE3_PREPARE
|
||||
{
|
||||
std::string sql = "SELECT ObjType,LedgerIndex,Object FROM CommittedObjects WHERE Hash = '";
|
||||
sql.append(hash.GetHex());
|
||||
sql.append("';");
|
||||
|
||||
ScopedLock sl(theApp->getHashNodeDB()->getDBLock());
|
||||
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtDISK, "HOS::retrieve"));
|
||||
SqliteStatement pSt(theApp->getHashNodeDB()->getDB()->getSqliteDB(),
|
||||
"SELECT ObjType,LedgerIndex,Object FROM CommittedObjects WHERE Hash = ?;");
|
||||
|
||||
pSt.bind(1, hash.GetHex());
|
||||
SqliteStatement pSt(theApp->getHashNodeDB()->getDB()->getSqliteDB(), sql.c_str());
|
||||
|
||||
int ret = pSt.step();
|
||||
if (pSt.isDone(ret))
|
||||
|
||||
@@ -74,10 +74,10 @@ void LedgerMaster::switchLedgers(Ledger::pointer lastClosed, Ledger::pointer cur
|
||||
mFinalizedLedger->setClosed();
|
||||
mFinalizedLedger->setAccepted();
|
||||
mCurrentLedger = current;
|
||||
}
|
||||
|
||||
assert(!mCurrentLedger->isClosed());
|
||||
mEngine.setLedger(mCurrentLedger);
|
||||
assert(!mCurrentLedger->isClosed());
|
||||
mEngine.setLedger(mCurrentLedger);
|
||||
}
|
||||
checkAccept(lastClosed->getHash(), lastClosed->getLedgerSeq());
|
||||
}
|
||||
|
||||
@@ -122,6 +122,7 @@ Ledger::pointer LedgerMaster::closeLedger(bool recover)
|
||||
|
||||
TER LedgerMaster::doTransaction(SerializedTransaction::ref txn, TransactionEngineParams params, bool& didApply)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
TER result = mEngine.applyTransaction(*txn, params, didApply);
|
||||
// if (didApply)
|
||||
theApp->getOPs().pubProposedTransaction(mEngine.getLedger(), txn, result);
|
||||
|
||||
Reference in New Issue
Block a user