mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 05:25:55 +00:00
Bugfixes.
This commit is contained in:
@@ -29,8 +29,8 @@ public:
|
|||||||
uint64 getBalance() const { return mBalance; }
|
uint64 getBalance() const { return mBalance; }
|
||||||
uint32 getSeq() const { return mAccountSeq; }
|
uint32 getSeq() const { return mAccountSeq; }
|
||||||
|
|
||||||
bool credit(uint64 a) { mBalance+=a; }
|
void credit(const uint64& a) { mBalance+=a; }
|
||||||
bool charge(uint64 a) { assert(mBalance>=a); mBalance-=a; }
|
void charge(const uint64& a) { assert(mBalance>=a); mBalance-=a; }
|
||||||
void incSeq() { mAccountSeq++; }
|
void incSeq() { mAccountSeq++; }
|
||||||
void decSeq() { assert(mAccountSeq!=0); mAccountSeq--; }
|
void decSeq() { assert(mAccountSeq!=0); mAccountSeq--; }
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ Ledger::Ledger(const uint256 &parentHash, const uint256 &transHash, const uint25
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ledger::Ledger(Ledger &prevLedger, uint64 ts) : mTimeStamp(ts),
|
Ledger::Ledger(Ledger &prevLedger, uint64 ts) : mTimeStamp(ts),
|
||||||
mTransactionMap(new SHAMap()), mAccountStateMap(prevLedger.mAccountStateMap),
|
mClosed(false), mValidHash(false), mAccepted(false),
|
||||||
mClosed(false), mValidHash(false), mAccepted(false)
|
mTransactionMap(new SHAMap()), mAccountStateMap(prevLedger.mAccountStateMap)
|
||||||
{
|
{
|
||||||
mParentHash=prevLedger.getHash();
|
mParentHash=prevLedger.getHash();
|
||||||
mLedgerSeq=prevLedger.mLedgerSeq+1;
|
mLedgerSeq=prevLedger.mLedgerSeq+1;
|
||||||
@@ -227,6 +227,7 @@ Ledger::TransResult Ledger::removeTransaction(Transaction::pointer trans)
|
|||||||
}
|
}
|
||||||
updateAccountState(fromAccount);
|
updateAccountState(fromAccount);
|
||||||
updateAccountState(toAccount);
|
updateAccountState(toAccount);
|
||||||
|
return TR_SUCCESS;
|
||||||
}
|
}
|
||||||
catch (SHAMapException)
|
catch (SHAMapException)
|
||||||
{
|
{
|
||||||
|
|||||||
2
Ledger.h
2
Ledger.h
@@ -69,7 +69,7 @@ public:
|
|||||||
void setClosed() { mClosed=true; }
|
void setClosed() { mClosed=true; }
|
||||||
void setAccepted() { mAccepted=true; }
|
void setAccepted() { mAccepted=true; }
|
||||||
bool isClosed() { return mClosed; }
|
bool isClosed() { return mClosed; }
|
||||||
bool isAccepted() { mAccepted=true; }
|
bool isAccepted() { return mAccepted; }
|
||||||
|
|
||||||
// ledger signature operations
|
// ledger signature operations
|
||||||
void addRaw(Serializer &s);
|
void addRaw(Serializer &s);
|
||||||
|
|||||||
@@ -267,6 +267,7 @@ SHAMapItem::pointer SHAMap::lastBelow(SHAMapInnerNode::pointer node)
|
|||||||
return mLeaf->lastItem();
|
return mLeaf->lastItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return SHAMapItem::pointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMapItem::pointer SHAMap::peekNextItem(const uint256& id)
|
SHAMapItem::pointer SHAMap::peekNextItem(const uint256& id)
|
||||||
@@ -478,6 +479,7 @@ bool SHAMap::fetchNode(const uint256& hash, std::vector<unsigned char>& data)
|
|||||||
HashedObject::pointer obj(HashedObject::retrieve(hash));
|
HashedObject::pointer obj(HashedObject::retrieve(hash));
|
||||||
if(!obj) return false;
|
if(!obj) return false;
|
||||||
data=obj->getData();
|
data=obj->getData();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SHAMap::flushDirty(int maxNodes, HashedObjectType t, uint32 seq)
|
int SHAMap::flushDirty(int maxNodes, HashedObjectType t, uint32 seq)
|
||||||
|
|||||||
2
SHAMap.h
2
SHAMap.h
@@ -126,7 +126,7 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool addUpdateItem(SHAMapItem::pointer);
|
bool addUpdateItem(SHAMapItem::pointer);
|
||||||
bool delItem(const SHAMapItem::pointer i) { delItem(i->getTag()); }
|
bool delItem(const SHAMapItem::pointer i) { return delItem(i->getTag()); }
|
||||||
bool delItem(const uint256& tag);
|
bool delItem(const uint256& tag);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public:
|
|||||||
mValid=true;
|
mValid=true;
|
||||||
sl.mValid=false;
|
sl.mValid=false;
|
||||||
}
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ int Serializer::addRaw(const std::vector<unsigned char> &vector)
|
|||||||
|
|
||||||
int Serializer::addRaw(const void *ptr, int len)
|
int Serializer::addRaw(const void *ptr, int len)
|
||||||
{
|
{
|
||||||
|
int ret=mData.size();
|
||||||
mData.insert(mData.end(), (const char *) ptr, ((const char *)ptr)+len);
|
mData.insert(mData.end(), (const char *) ptr, ((const char *)ptr)+len);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Serializer::get16(uint16& o, int offset) const
|
bool Serializer::get16(uint16& o, int offset) const
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
LocalAccount::LocalAccount(bool) : mAmount(0), mSeqNum(0), mPublicKey(new CKey())
|
LocalAccount::LocalAccount(bool) : mPublicKey(new CKey()), mAmount(0), mSeqNum(0)
|
||||||
{
|
{
|
||||||
mPrivateKey.MakeNewKey();
|
mPrivateKey.MakeNewKey();
|
||||||
mPublicKey->SetPubKey(mPrivateKey.GetPubKey());
|
mPublicKey->SetPubKey(mPrivateKey.GetPubKey());
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <strings.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
Database::Database(const char* host,const char* user,const char* pass) : mNumCol(0)
|
Database::Database(const char* host,const char* user,const char* pass) : mNumCol(0)
|
||||||
@@ -82,7 +82,7 @@ bool Database::getColNumber(const char* colName,int* retIndex)
|
|||||||
{
|
{
|
||||||
for(unsigned int n=0; n<mColNameTable.size(); n++)
|
for(unsigned int n=0; n<mColNameTable.size(); n++)
|
||||||
{
|
{
|
||||||
if(strcasecmp(colName,mColNameTable[n].c_str())==0)
|
if(strcmp(colName,mColNameTable[n].c_str())==0)
|
||||||
{
|
{
|
||||||
*retIndex=n;
|
*retIndex=n;
|
||||||
return(true);
|
return(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user