mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Merge branch 'develop' of github.com:jedmccaleb/NewCoin into develop
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -107,9 +107,9 @@ extern "C" {
|
|||||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||||
** [sqlite_version()] and [sqlite_source_id()].
|
** [sqlite_version()] and [sqlite_source_id()].
|
||||||
*/
|
*/
|
||||||
#define SQLITE_VERSION "3.7.15.2"
|
#define SQLITE_VERSION "3.7.16.2"
|
||||||
#define SQLITE_VERSION_NUMBER 3007015
|
#define SQLITE_VERSION_NUMBER 3007016
|
||||||
#define SQLITE_SOURCE_ID "2013-01-09 11:53:05 c0e09560d26f0a6456be9dd3447f5311eb4f238f"
|
#define SQLITE_SOURCE_ID "2013-04-12 11:52:43 cbea02d93865ce0e06789db95fd9168ebac970c7"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Run-Time Library Version Numbers
|
** CAPI3REF: Run-Time Library Version Numbers
|
||||||
@@ -285,10 +285,10 @@ typedef sqlite_uint64 sqlite3_uint64;
|
|||||||
** destructors are called is arbitrary.
|
** destructors are called is arbitrary.
|
||||||
**
|
**
|
||||||
** Applications should [sqlite3_finalize | finalize] all [prepared statements],
|
** Applications should [sqlite3_finalize | finalize] all [prepared statements],
|
||||||
** [sqlite3_blob_close | close] all [BLOB handles], and
|
** [sqlite3_blob_close | close] all [BLOB handles], and
|
||||||
** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated
|
** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated
|
||||||
** with the [sqlite3] object prior to attempting to close the object. ^If
|
** with the [sqlite3] object prior to attempting to close the object. ^If
|
||||||
** sqlite3_close() is called on a [database connection] that still has
|
** sqlite3_close_v2() is called on a [database connection] that still has
|
||||||
** outstanding [prepared statements], [BLOB handles], and/or
|
** outstanding [prepared statements], [BLOB handles], and/or
|
||||||
** [sqlite3_backup] objects then it returns SQLITE_OK but the deallocation
|
** [sqlite3_backup] objects then it returns SQLITE_OK but the deallocation
|
||||||
** of resources is deferred until all [prepared statements], [BLOB handles],
|
** of resources is deferred until all [prepared statements], [BLOB handles],
|
||||||
@@ -483,7 +483,17 @@ SQLITE_API int sqlite3_exec(
|
|||||||
#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
|
#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
|
||||||
#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
|
#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
|
||||||
#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
|
#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
|
||||||
|
#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8))
|
||||||
#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8))
|
#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8))
|
||||||
|
#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8))
|
||||||
|
#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8))
|
||||||
|
#define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8))
|
||||||
|
#define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8))
|
||||||
|
#define SQLITE_CONSTRAINT_NOTNULL (SQLITE_CONSTRAINT | (5<<8))
|
||||||
|
#define SQLITE_CONSTRAINT_PRIMARYKEY (SQLITE_CONSTRAINT | (6<<8))
|
||||||
|
#define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7<<8))
|
||||||
|
#define SQLITE_CONSTRAINT_UNIQUE (SQLITE_CONSTRAINT | (8<<8))
|
||||||
|
#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Flags For File Open Operations
|
** CAPI3REF: Flags For File Open Operations
|
||||||
@@ -2651,10 +2661,10 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|||||||
**
|
**
|
||||||
** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw",
|
** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw",
|
||||||
** "rwc", or "memory". Attempting to set it to any other value is
|
** "rwc", or "memory". Attempting to set it to any other value is
|
||||||
** an error)^.
|
** an error)^.
|
||||||
** ^If "ro" is specified, then the database is opened for read-only
|
** ^If "ro" is specified, then the database is opened for read-only
|
||||||
** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the
|
** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the
|
||||||
** third argument to sqlite3_open_v2(). ^If the mode option is set to
|
** third argument to sqlite3_open_v2(). ^If the mode option is set to
|
||||||
** "rw", then the database is opened for read-write (but not create)
|
** "rw", then the database is opened for read-write (but not create)
|
||||||
** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had
|
** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had
|
||||||
** been set. ^Value "rwc" is equivalent to setting both
|
** been set. ^Value "rwc" is equivalent to setting both
|
||||||
@@ -2670,7 +2680,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|||||||
** sqlite3_open_v2(). ^Setting the cache parameter to "private" is
|
** sqlite3_open_v2(). ^Setting the cache parameter to "private" is
|
||||||
** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.
|
** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.
|
||||||
** ^If sqlite3_open_v2() is used and the "cache" parameter is present in
|
** ^If sqlite3_open_v2() is used and the "cache" parameter is present in
|
||||||
** a URI filename, its value overrides any behaviour requested by setting
|
** a URI filename, its value overrides any behavior requested by setting
|
||||||
** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.
|
** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.
|
||||||
** </ul>
|
** </ul>
|
||||||
**
|
**
|
||||||
@@ -3988,7 +3998,8 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
|
|||||||
SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
|
SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
|
||||||
SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
|
SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
|
||||||
SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
|
SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
|
||||||
SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64);
|
SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
|
||||||
|
void*,sqlite3_int64);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -4068,14 +4079,17 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
|
|||||||
** In those cases, sqlite3_aggregate_context() might be called for the
|
** In those cases, sqlite3_aggregate_context() might be called for the
|
||||||
** first time from within xFinal().)^
|
** first time from within xFinal().)^
|
||||||
**
|
**
|
||||||
** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer if N is
|
** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer
|
||||||
** less than or equal to zero or if a memory allocate error occurs.
|
** when first called if N is less than or equal to zero or if a memory
|
||||||
|
** allocate error occurs.
|
||||||
**
|
**
|
||||||
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
|
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
|
||||||
** determined by the N parameter on first successful call. Changing the
|
** determined by the N parameter on first successful call. Changing the
|
||||||
** value of N in subsequent call to sqlite3_aggregate_context() within
|
** value of N in subsequent call to sqlite3_aggregate_context() within
|
||||||
** the same aggregate function instance will not resize the memory
|
** the same aggregate function instance will not resize the memory
|
||||||
** allocation.)^
|
** allocation.)^ Within the xFinal callback, it is customary to set
|
||||||
|
** N=0 in calls to sqlite3_aggregate_context(C,N) so that no
|
||||||
|
** pointless memory allocations occur.
|
||||||
**
|
**
|
||||||
** ^SQLite automatically frees the memory allocated by
|
** ^SQLite automatically frees the memory allocated by
|
||||||
** sqlite3_aggregate_context() when the aggregate query concludes.
|
** sqlite3_aggregate_context() when the aggregate query concludes.
|
||||||
@@ -4531,7 +4545,7 @@ SQLITE_API int sqlite3_sleep(int);
|
|||||||
** ^The [temp_store_directory pragma] may modify this variable and cause
|
** ^The [temp_store_directory pragma] may modify this variable and cause
|
||||||
** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
|
** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
|
||||||
** the [temp_store_directory pragma] always assumes that any string
|
** the [temp_store_directory pragma] always assumes that any string
|
||||||
** that this variable points to is held in memory obtained from
|
** that this variable points to is held in memory obtained from
|
||||||
** [sqlite3_malloc] and the pragma may attempt to free that memory
|
** [sqlite3_malloc] and the pragma may attempt to free that memory
|
||||||
** using [sqlite3_free].
|
** using [sqlite3_free].
|
||||||
** Hence, if this variable is modified directly, either it should be
|
** Hence, if this variable is modified directly, either it should be
|
||||||
@@ -6369,7 +6383,7 @@ struct sqlite3_pcache_page {
|
|||||||
** parameter to help it determined what action to take:
|
** parameter to help it determined what action to take:
|
||||||
**
|
**
|
||||||
** <table border=1 width=85% align=center>
|
** <table border=1 width=85% align=center>
|
||||||
** <tr><th> createFlag <th> Behaviour when page is not already in cache
|
** <tr><th> createFlag <th> Behavior when page is not already in cache
|
||||||
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
|
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
|
||||||
** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
|
** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
|
||||||
** Otherwise return NULL.
|
** Otherwise return NULL.
|
||||||
|
|||||||
@@ -236,6 +236,20 @@ struct sqlite3_api_routines {
|
|||||||
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
|
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
|
||||||
int (*vtab_config)(sqlite3*,int op,...);
|
int (*vtab_config)(sqlite3*,int op,...);
|
||||||
int (*vtab_on_conflict)(sqlite3*);
|
int (*vtab_on_conflict)(sqlite3*);
|
||||||
|
/* Version 3.7.16 and later */
|
||||||
|
int (*close_v2)(sqlite3*);
|
||||||
|
const char *(*db_filename)(sqlite3*,const char*);
|
||||||
|
int (*db_readonly)(sqlite3*,const char*);
|
||||||
|
int (*db_release_memory)(sqlite3*);
|
||||||
|
const char *(*errstr)(int);
|
||||||
|
int (*stmt_busy)(sqlite3_stmt*);
|
||||||
|
int (*stmt_readonly)(sqlite3_stmt*);
|
||||||
|
int (*stricmp)(const char*,const char*);
|
||||||
|
int (*uri_boolean)(const char*,const char*,int);
|
||||||
|
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
|
||||||
|
const char *(*uri_parameter)(const char*,const char*);
|
||||||
|
char *(*vsnprintf)(int,char*,const char*,va_list);
|
||||||
|
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -439,6 +453,20 @@ struct sqlite3_api_routines {
|
|||||||
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
|
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
|
||||||
#define sqlite3_vtab_config sqlite3_api->vtab_config
|
#define sqlite3_vtab_config sqlite3_api->vtab_config
|
||||||
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
|
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
|
||||||
|
/* Version 3.7.16 and later */
|
||||||
|
#define sqlite3_close_v2 sqlite3_api->close_v2
|
||||||
|
#define sqlite3_db_filename sqlite3_api->db_filename
|
||||||
|
#define sqlite3_db_readonly sqlite3_api->db_readonly
|
||||||
|
#define sqlite3_db_release_memory sqlite3_api->db_release_memory
|
||||||
|
#define sqlite3_errstr sqlite3_api->errstr
|
||||||
|
#define sqlite3_stmt_busy sqlite3_api->stmt_busy
|
||||||
|
#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly
|
||||||
|
#define sqlite3_stricmp sqlite3_api->stricmp
|
||||||
|
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
|
||||||
|
#define sqlite3_uri_int64 sqlite3_api->uri_int64
|
||||||
|
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
|
||||||
|
#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf
|
||||||
|
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
|
||||||
#endif /* SQLITE_CORE */
|
#endif /* SQLITE_CORE */
|
||||||
|
|
||||||
#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api = 0;
|
#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api = 0;
|
||||||
|
|||||||
@@ -505,6 +505,11 @@ Reader::readObject( Token &tokenStart )
|
|||||||
colon,
|
colon,
|
||||||
tokenObjectEnd );
|
tokenObjectEnd );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reject duplicate names
|
||||||
|
if (currentValue().isMember(name))
|
||||||
|
return addError( "Key '" + name + "' appears twice.", tokenName );
|
||||||
|
|
||||||
Value &value = currentValue()[ name ];
|
Value &value = currentValue()[ name ];
|
||||||
nodes_.push( &value );
|
nodes_.push( &value );
|
||||||
bool ok = readValue();
|
bool ok = readValue();
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::ref previou
|
|||||||
mCloseResolution = ContinuousLedgerTiming::getNextLedgerTimeResolution(
|
mCloseResolution = ContinuousLedgerTiming::getNextLedgerTimeResolution(
|
||||||
mPreviousLedger->getCloseResolution(), mPreviousLedger->getCloseAgree(), previousLedger->getLedgerSeq() + 1);
|
mPreviousLedger->getCloseResolution(), mPreviousLedger->getCloseAgree(), previousLedger->getLedgerSeq() + 1);
|
||||||
|
|
||||||
if (mValPublic.isValid() && mValPrivate.isValid() && !theApp->getOPs().isNeedNetworkLedger())
|
if (mValPublic.isSet() && mValPrivate.isSet() && !theApp->getOPs().isNeedNetworkLedger())
|
||||||
{
|
{
|
||||||
cLog(lsINFO) << "Entering consensus process, validating";
|
cLog(lsINFO) << "Entering consensus process, validating";
|
||||||
mValidating = true;
|
mValidating = true;
|
||||||
@@ -183,7 +183,7 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::ref previou
|
|||||||
|
|
||||||
void LedgerConsensus::checkOurValidation()
|
void LedgerConsensus::checkOurValidation()
|
||||||
{ // This only covers some cases - Fix for the case where we can't ever acquire the consensus ledger
|
{ // This only covers some cases - Fix for the case where we can't ever acquire the consensus ledger
|
||||||
if (!mHaveCorrectLCL || !mValPublic.isValid() || !mValPrivate.isValid() || theApp->getOPs().isNeedNetworkLedger())
|
if (!mHaveCorrectLCL || !mValPublic.isSet() || !mValPrivate.isSet() || theApp->getOPs().isNeedNetworkLedger())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SerializedValidation::pointer lastVal = theApp->getOPs().getLastValidation();
|
SerializedValidation::pointer lastVal = theApp->getOPs().getLastValidation();
|
||||||
|
|||||||
@@ -39,18 +39,20 @@ LedgerEntrySet LedgerEntrySet::duplicate() const
|
|||||||
|
|
||||||
void LedgerEntrySet::setTo(const LedgerEntrySet& e)
|
void LedgerEntrySet::setTo(const LedgerEntrySet& e)
|
||||||
{
|
{
|
||||||
|
mLedger = e.mLedger;
|
||||||
mEntries = e.mEntries;
|
mEntries = e.mEntries;
|
||||||
mSet = e.mSet;
|
mSet = e.mSet;
|
||||||
|
mParams = e.mParams;
|
||||||
mSeq = e.mSeq;
|
mSeq = e.mSeq;
|
||||||
mLedger = e.mLedger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerEntrySet::swapWith(LedgerEntrySet& e)
|
void LedgerEntrySet::swapWith(LedgerEntrySet& e)
|
||||||
{
|
{
|
||||||
std::swap(mSeq, e.mSeq);
|
|
||||||
std::swap(mLedger, e.mLedger);
|
std::swap(mLedger, e.mLedger);
|
||||||
mSet.swap(e.mSet);
|
|
||||||
mEntries.swap(e.mEntries);
|
mEntries.swap(e.mEntries);
|
||||||
|
mSet.swap(e.mSet);
|
||||||
|
std::swap(mParams, e.mParams);
|
||||||
|
std::swap(mSeq, e.mSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find an entry in the set. If it has the wrong sequence number, copy it and update the sequence number.
|
// Find an entry in the set. If it has the wrong sequence number, copy it and update the sequence number.
|
||||||
@@ -65,6 +67,7 @@ SLE::pointer LedgerEntrySet::getEntry(const uint256& index, LedgerEntryAction& a
|
|||||||
}
|
}
|
||||||
if (it->second.mSeq != mSeq)
|
if (it->second.mSeq != mSeq)
|
||||||
{
|
{
|
||||||
|
assert(it->second.mSeq < mSeq);
|
||||||
it->second.mEntry = boost::make_shared<SerializedLedgerEntry>(*it->second.mEntry);
|
it->second.mEntry = boost::make_shared<SerializedLedgerEntry>(*it->second.mEntry);
|
||||||
it->second.mSeq = mSeq;
|
it->second.mSeq = mSeq;
|
||||||
}
|
}
|
||||||
@@ -82,6 +85,7 @@ SLE::pointer LedgerEntrySet::entryCreate(LedgerEntryType letType, const uint256&
|
|||||||
|
|
||||||
SLE::pointer LedgerEntrySet::entryCache(LedgerEntryType letType, const uint256& index)
|
SLE::pointer LedgerEntrySet::entryCache(LedgerEntryType letType, const uint256& index)
|
||||||
{
|
{
|
||||||
|
assert(mLedger);
|
||||||
SLE::pointer sleEntry;
|
SLE::pointer sleEntry;
|
||||||
if (index.isNonZero())
|
if (index.isNonZero())
|
||||||
{
|
{
|
||||||
@@ -89,6 +93,7 @@ SLE::pointer LedgerEntrySet::entryCache(LedgerEntryType letType, const uint256&
|
|||||||
sleEntry = getEntry(index, action);
|
sleEntry = getEntry(index, action);
|
||||||
if (!sleEntry)
|
if (!sleEntry)
|
||||||
{
|
{
|
||||||
|
assert(action != taaDELETE);
|
||||||
sleEntry = mLedger->getSLE(index);
|
sleEntry = mLedger->getSLE(index);
|
||||||
if (sleEntry)
|
if (sleEntry)
|
||||||
entryCache(sleEntry);
|
entryCache(sleEntry);
|
||||||
@@ -109,6 +114,7 @@ LedgerEntryAction LedgerEntrySet::hasEntry(const uint256& index) const
|
|||||||
|
|
||||||
void LedgerEntrySet::entryCache(SLE::ref sle)
|
void LedgerEntrySet::entryCache(SLE::ref sle)
|
||||||
{
|
{
|
||||||
|
assert(mLedger);
|
||||||
assert(sle->isMutable());
|
assert(sle->isMutable());
|
||||||
std::map<uint256, LedgerEntrySetEntry>::iterator it = mEntries.find(sle->getIndex());
|
std::map<uint256, LedgerEntrySetEntry>::iterator it = mEntries.find(sle->getIndex());
|
||||||
if (it == mEntries.end())
|
if (it == mEntries.end())
|
||||||
@@ -120,6 +126,7 @@ void LedgerEntrySet::entryCache(SLE::ref sle)
|
|||||||
switch (it->second.mAction)
|
switch (it->second.mAction)
|
||||||
{
|
{
|
||||||
case taaCACHED:
|
case taaCACHED:
|
||||||
|
assert(sle == it->second.mEntry);
|
||||||
it->second.mSeq = mSeq;
|
it->second.mSeq = mSeq;
|
||||||
it->second.mEntry = sle;
|
it->second.mEntry = sle;
|
||||||
return;
|
return;
|
||||||
@@ -131,6 +138,7 @@ void LedgerEntrySet::entryCache(SLE::ref sle)
|
|||||||
|
|
||||||
void LedgerEntrySet::entryCreate(SLE::ref sle)
|
void LedgerEntrySet::entryCreate(SLE::ref sle)
|
||||||
{
|
{
|
||||||
|
assert(mLedger);
|
||||||
assert(sle->isMutable());
|
assert(sle->isMutable());
|
||||||
std::map<uint256, LedgerEntrySetEntry>::iterator it = mEntries.find(sle->getIndex());
|
std::map<uint256, LedgerEntrySetEntry>::iterator it = mEntries.find(sle->getIndex());
|
||||||
if (it == mEntries.end())
|
if (it == mEntries.end())
|
||||||
@@ -143,6 +151,7 @@ void LedgerEntrySet::entryCreate(SLE::ref sle)
|
|||||||
{
|
{
|
||||||
|
|
||||||
case taaDELETE:
|
case taaDELETE:
|
||||||
|
cLog(lsDEBUG) << "Create after Delete = Modify";
|
||||||
it->second.mEntry = sle;
|
it->second.mEntry = sle;
|
||||||
it->second.mAction = taaMODIFY;
|
it->second.mAction = taaMODIFY;
|
||||||
it->second.mSeq = mSeq;
|
it->second.mSeq = mSeq;
|
||||||
@@ -167,6 +176,7 @@ void LedgerEntrySet::entryCreate(SLE::ref sle)
|
|||||||
void LedgerEntrySet::entryModify(SLE::ref sle)
|
void LedgerEntrySet::entryModify(SLE::ref sle)
|
||||||
{
|
{
|
||||||
assert(sle->isMutable());
|
assert(sle->isMutable());
|
||||||
|
assert(mLedger);
|
||||||
std::map<uint256, LedgerEntrySetEntry>::iterator it = mEntries.find(sle->getIndex());
|
std::map<uint256, LedgerEntrySetEntry>::iterator it = mEntries.find(sle->getIndex());
|
||||||
if (it == mEntries.end())
|
if (it == mEntries.end())
|
||||||
{
|
{
|
||||||
@@ -175,7 +185,7 @@ void LedgerEntrySet::entryModify(SLE::ref sle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(it->second.mSeq == mSeq);
|
assert(it->second.mSeq == mSeq);
|
||||||
assert(*it->second.mEntry == *sle);
|
assert(it->second.mEntry == sle);
|
||||||
|
|
||||||
switch (it->second.mAction)
|
switch (it->second.mAction)
|
||||||
{
|
{
|
||||||
@@ -200,15 +210,17 @@ void LedgerEntrySet::entryModify(SLE::ref sle)
|
|||||||
void LedgerEntrySet::entryDelete(SLE::ref sle)
|
void LedgerEntrySet::entryDelete(SLE::ref sle)
|
||||||
{
|
{
|
||||||
assert(sle->isMutable());
|
assert(sle->isMutable());
|
||||||
|
assert(mLedger);
|
||||||
std::map<uint256, LedgerEntrySetEntry>::iterator it = mEntries.find(sle->getIndex());
|
std::map<uint256, LedgerEntrySetEntry>::iterator it = mEntries.find(sle->getIndex());
|
||||||
if (it == mEntries.end())
|
if (it == mEntries.end())
|
||||||
{
|
{
|
||||||
|
assert(false); // deleting an entry not cached?
|
||||||
mEntries.insert(std::make_pair(sle->getIndex(), LedgerEntrySetEntry(sle, taaDELETE, mSeq)));
|
mEntries.insert(std::make_pair(sle->getIndex(), LedgerEntrySetEntry(sle, taaDELETE, mSeq)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(it->second.mSeq == mSeq);
|
assert(it->second.mSeq == mSeq);
|
||||||
assert(*it->second.mEntry == *sle);
|
assert(it->second.mEntry == sle);
|
||||||
|
|
||||||
switch (it->second.mAction)
|
switch (it->second.mAction)
|
||||||
{
|
{
|
||||||
@@ -541,8 +553,7 @@ TER LedgerEntrySet::dirAdd(
|
|||||||
const uint256& uLedgerIndex,
|
const uint256& uLedgerIndex,
|
||||||
FUNCTION_TYPE<void (SLE::ref)> fDescriber)
|
FUNCTION_TYPE<void (SLE::ref)> fDescriber)
|
||||||
{
|
{
|
||||||
cLog(lsDEBUG)
|
cLog(lsDEBUG) << boost::str(boost::format("dirAdd: uRootIndex=%s uLedgerIndex=%s")
|
||||||
<< boost::str(boost::format("dirAdd: uRootIndex=%s uLedgerIndex=%s")
|
|
||||||
% uRootIndex.ToString()
|
% uRootIndex.ToString()
|
||||||
% uLedgerIndex.ToString());
|
% uLedgerIndex.ToString());
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ public:
|
|||||||
LedgerEntrySet duplicate() const; // Make a duplicate of this set
|
LedgerEntrySet duplicate() const; // Make a duplicate of this set
|
||||||
void setTo(const LedgerEntrySet&); // Set this set to have the same contents as another
|
void setTo(const LedgerEntrySet&); // Set this set to have the same contents as another
|
||||||
void swapWith(LedgerEntrySet&); // Swap the contents of two sets
|
void swapWith(LedgerEntrySet&); // Swap the contents of two sets
|
||||||
|
void invalidate() { mLedger.reset(); }
|
||||||
|
bool isValid() const { return !!mLedger; }
|
||||||
|
|
||||||
int getSeq() const { return mSeq; }
|
int getSeq() const { return mSeq; }
|
||||||
TransactionEngineParams getParams() const { return mParams; }
|
TransactionEngineParams getParams() const { return mParams; }
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ bool Pathfinder::bDefaultPath(const STPath& spPath)
|
|||||||
return false; // Didn't generate a default path. So can't match.
|
return false; // Didn't generate a default path. So can't match.
|
||||||
}
|
}
|
||||||
|
|
||||||
PathState::pointer pspCurrent = boost::make_shared<PathState>(mDstAmount, mSrcAmount, mLedger);
|
PathState::pointer pspCurrent = boost::make_shared<PathState>(mDstAmount, mSrcAmount);
|
||||||
|
|
||||||
if (pspCurrent)
|
if (pspCurrent)
|
||||||
{
|
{
|
||||||
@@ -163,7 +163,7 @@ Pathfinder::Pathfinder(Ledger::ref ledger,
|
|||||||
|
|
||||||
// Construct the default path for later comparison.
|
// Construct the default path for later comparison.
|
||||||
|
|
||||||
PathState::pointer psDefault = boost::make_shared<PathState>(mDstAmount, mSrcAmount, mLedger);
|
PathState::pointer psDefault = boost::make_shared<PathState>(mDstAmount, mSrcAmount);
|
||||||
|
|
||||||
if (psDefault)
|
if (psDefault)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ void RippleAddress::clear()
|
|||||||
vchData.clear();
|
vchData.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RippleAddress::isSet() const
|
||||||
|
{
|
||||||
|
return nVersion != VER_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
std::string RippleAddress::humanAddressType() const
|
std::string RippleAddress::humanAddressType() const
|
||||||
{
|
{
|
||||||
switch (nVersion)
|
switch (nVersion)
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ public:
|
|||||||
|
|
||||||
// For public and private key, checks if they are legal.
|
// For public and private key, checks if they are legal.
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
bool isSet() const;
|
||||||
|
|
||||||
std::string humanAddressType() const;
|
std::string humanAddressType() const;
|
||||||
|
|
||||||
|
|||||||
@@ -884,9 +884,13 @@ TER RippleCalc::calcNodeAdvance(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bDirectAdvance)
|
if (bDirectAdvance)
|
||||||
{
|
{ // Get next quality.
|
||||||
// Get next quality.
|
|
||||||
|
// FIXME: This looks at the original ledger and doesn't take into account any changes
|
||||||
|
// in the LedgerEntrySet. If this code, for example, created offers, this would
|
||||||
|
// not return the pages they're in.
|
||||||
uDirectTip = lesActive.getLedger()->getNextLedgerIndex(uDirectTip, uDirectEnd);
|
uDirectTip = lesActive.getLedger()->getNextLedgerIndex(uDirectTip, uDirectEnd);
|
||||||
|
|
||||||
bDirectDirDirty = true;
|
bDirectDirDirty = true;
|
||||||
bDirectAdvance = false;
|
bDirectAdvance = false;
|
||||||
|
|
||||||
@@ -2584,8 +2588,7 @@ void RippleCalc::pathNext(PathState::ref psrCur, const bool bMultiQuality, const
|
|||||||
|
|
||||||
assert(psrCur->vpnNodes.size() >= 2);
|
assert(psrCur->vpnNodes.size() >= 2);
|
||||||
|
|
||||||
lesCurrent = lesCheckpoint; // Restore from checkpoint.
|
lesCurrent = lesCheckpoint.duplicate(); // Restore from checkpoint.
|
||||||
lesCurrent.bumpSeq(); // Begin ledger variance.
|
|
||||||
|
|
||||||
psrCur->terStatus = calcNodeRev(uLast, *psrCur, bMultiQuality);
|
psrCur->terStatus = calcNodeRev(uLast, *psrCur, bMultiQuality);
|
||||||
|
|
||||||
@@ -2594,8 +2597,7 @@ void RippleCalc::pathNext(PathState::ref psrCur, const bool bMultiQuality, const
|
|||||||
if (tesSUCCESS == psrCur->terStatus)
|
if (tesSUCCESS == psrCur->terStatus)
|
||||||
{
|
{
|
||||||
// Do forward.
|
// Do forward.
|
||||||
lesCurrent = lesCheckpoint; // Restore from checkpoint.
|
lesCurrent = lesCheckpoint.duplicate(); // Restore from checkpoint.
|
||||||
lesCurrent.bumpSeq(); // Begin ledger variance.
|
|
||||||
|
|
||||||
psrCur->terStatus = calcNodeFwd(0, *psrCur, bMultiQuality);
|
psrCur->terStatus = calcNodeFwd(0, *psrCur, bMultiQuality);
|
||||||
}
|
}
|
||||||
@@ -2647,6 +2649,7 @@ TER RippleCalc::rippleCalc(
|
|||||||
const bool bOpenLedger
|
const bool bOpenLedger
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
assert(lesActive.isValid());
|
||||||
RippleCalc rc(lesActive, bOpenLedger);
|
RippleCalc rc(lesActive, bOpenLedger);
|
||||||
|
|
||||||
cLog(lsTRACE) << boost::str(boost::format("rippleCalc> saMaxAmountReq=%s saDstAmountReq=%s")
|
cLog(lsTRACE) << boost::str(boost::format("rippleCalc> saMaxAmountReq=%s saDstAmountReq=%s")
|
||||||
@@ -2672,7 +2675,7 @@ TER RippleCalc::rippleCalc(
|
|||||||
// Build a default path. Use saDstAmountReq and saMaxAmountReq to imply nodes.
|
// Build a default path. Use saDstAmountReq and saMaxAmountReq to imply nodes.
|
||||||
// XXX Might also make a XRP bridge by default.
|
// XXX Might also make a XRP bridge by default.
|
||||||
|
|
||||||
PathState::pointer pspDirect = boost::make_shared<PathState>(saDstAmountReq, saMaxAmountReq, lesActive.getLedgerRef());
|
PathState::pointer pspDirect = boost::make_shared<PathState>(saDstAmountReq, saMaxAmountReq);
|
||||||
|
|
||||||
if (!pspDirect)
|
if (!pspDirect)
|
||||||
return temUNKNOWN;
|
return temUNKNOWN;
|
||||||
@@ -2702,10 +2705,10 @@ cLog(lsDEBUG) << boost::str(boost::format("rippleCalc: Build direct: status: %s"
|
|||||||
|
|
||||||
cLog(lsTRACE) << "rippleCalc: Paths in set: " << spsPaths.size();
|
cLog(lsTRACE) << "rippleCalc: Paths in set: " << spsPaths.size();
|
||||||
|
|
||||||
int iIndex = 0;
|
int iIndex = 0;
|
||||||
BOOST_FOREACH(const STPath& spPath, spsPaths)
|
BOOST_FOREACH(const STPath& spPath, spsPaths)
|
||||||
{
|
{
|
||||||
PathState::pointer pspExpanded = boost::make_shared<PathState>(saDstAmountReq, saMaxAmountReq, lesActive.getLedgerRef());
|
PathState::pointer pspExpanded = boost::make_shared<PathState>(saDstAmountReq, saMaxAmountReq);
|
||||||
|
|
||||||
if (!pspExpanded)
|
if (!pspExpanded)
|
||||||
return temUNKNOWN;
|
return temUNKNOWN;
|
||||||
@@ -2805,7 +2808,10 @@ int iPass = 0;
|
|||||||
% pspCur->saInPass.getFullText()
|
% pspCur->saInPass.getFullText()
|
||||||
% pspCur->saOutPass.getFullText());
|
% pspCur->saOutPass.getFullText());
|
||||||
|
|
||||||
|
assert(lesActive.isValid());
|
||||||
lesActive.swapWith(pspCur->lesEntries); // For the path, save ledger state.
|
lesActive.swapWith(pspCur->lesEntries); // For the path, save ledger state.
|
||||||
|
lesActive.invalidate();
|
||||||
|
|
||||||
iBest = pspCur->getIndex();
|
iBest = pspCur->getIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2840,7 +2846,9 @@ int iPass = 0;
|
|||||||
vuUnfundedBecame.insert(vuUnfundedBecame.end(), pspBest->vUnfundedBecame.begin(), pspBest->vUnfundedBecame.end());
|
vuUnfundedBecame.insert(vuUnfundedBecame.end(), pspBest->vUnfundedBecame.begin(), pspBest->vUnfundedBecame.end());
|
||||||
|
|
||||||
// Record best pass' LedgerEntrySet to build off of and potentially return.
|
// Record best pass' LedgerEntrySet to build off of and potentially return.
|
||||||
|
assert(pspBest->lesEntries.isValid());
|
||||||
lesActive.swapWith(pspBest->lesEntries);
|
lesActive.swapWith(pspBest->lesEntries);
|
||||||
|
pspBest->lesEntries.invalidate();
|
||||||
|
|
||||||
saMaxAmountAct += pspBest->saInPass;
|
saMaxAmountAct += pspBest->saInPass;
|
||||||
saDstAmountAct += pspBest->saOutPass;
|
saDstAmountAct += pspBest->saOutPass;
|
||||||
|
|||||||
@@ -71,8 +71,6 @@ extern std::size_t hash_value(const aciSource& asValue);
|
|||||||
class PathState
|
class PathState
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
Ledger::pointer mLedger;
|
|
||||||
|
|
||||||
TER pushNode(const int iType, const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID);
|
TER pushNode(const int iType, const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID);
|
||||||
TER pushImply(const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID);
|
TER pushImply(const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID);
|
||||||
|
|
||||||
@@ -116,12 +114,11 @@ public:
|
|||||||
|
|
||||||
PathState(
|
PathState(
|
||||||
const STAmount& saSend,
|
const STAmount& saSend,
|
||||||
const STAmount& saSendMax,
|
const STAmount& saSendMax
|
||||||
Ledger::pointer lrLedger = Ledger::pointer()
|
) : saInReq(saSendMax), saOutReq(saSend) { ; }
|
||||||
) : mLedger(lrLedger), saInReq(saSendMax), saOutReq(saSend) { ; }
|
|
||||||
|
|
||||||
PathState(const PathState& psSrc, bool bUnused)
|
PathState(const PathState& psSrc, bool bUnused)
|
||||||
: mLedger(psSrc.mLedger), saInReq(psSrc.saInReq), saOutReq(psSrc.saOutReq) { ; }
|
: saInReq(psSrc.saInReq), saOutReq(psSrc.saOutReq) { ; }
|
||||||
|
|
||||||
void setExpanded(
|
void setExpanded(
|
||||||
const LedgerEntrySet& lesSource,
|
const LedgerEntrySet& lesSource,
|
||||||
|
|||||||
Reference in New Issue
Block a user