mirror of
https://github.com/Xahau/xahaud.git
synced 2026-04-29 15:37:46 +00:00
Replace std::vector<unsigned char> with Blob
This commit is contained in:
@@ -207,11 +207,11 @@ int SqliteDatabase::getBinary(int colIndex,unsigned char* buf,int maxSize)
|
||||
return(size);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> SqliteDatabase::getBinary(int colIndex)
|
||||
Blob SqliteDatabase::getBinary(int colIndex)
|
||||
{
|
||||
const unsigned char* blob = reinterpret_cast<const unsigned char*>(sqlite3_column_blob(mCurrentStmt, colIndex));
|
||||
size_t iSize = sqlite3_column_bytes(mCurrentStmt, colIndex);
|
||||
std::vector<unsigned char> vucResult;
|
||||
Blob vucResult;
|
||||
|
||||
vucResult.resize(iSize);
|
||||
std::copy(blob, blob+iSize, vucResult.begin());
|
||||
@@ -324,7 +324,7 @@ int SqliteStatement::bindStatic(int position, const void *data, int length)
|
||||
return sqlite3_bind_blob(statement, position, data, length, SQLITE_STATIC);
|
||||
}
|
||||
|
||||
int SqliteStatement::bindStatic(int position, const std::vector<unsigned char>& value)
|
||||
int SqliteStatement::bindStatic(int position, Blob const& value)
|
||||
{
|
||||
return sqlite3_bind_blob(statement, position, &value.front(), value.size(), SQLITE_STATIC);
|
||||
}
|
||||
@@ -359,10 +359,10 @@ const void* SqliteStatement::peekBlob(int column)
|
||||
return sqlite3_column_blob(statement, column);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> SqliteStatement::getBlob(int column)
|
||||
Blob SqliteStatement::getBlob(int column)
|
||||
{
|
||||
int size = sqlite3_column_bytes(statement, column);
|
||||
std::vector<unsigned char> ret(size);
|
||||
Blob ret(size);
|
||||
memcpy(&(ret.front()), sqlite3_column_blob(statement, column), size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
bool getBool(int colIndex);
|
||||
// returns amount stored in buf
|
||||
int getBinary(int colIndex,unsigned char* buf,int maxSize);
|
||||
std::vector<unsigned char> getBinary(int colIndex);
|
||||
Blob getBinary(int colIndex);
|
||||
uint64 getBigInt(int colIndex);
|
||||
|
||||
sqlite3* peekConnection() { return mConnection; }
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
// positions start at 1
|
||||
int bind(int position, const void *data, int length);
|
||||
int bindStatic(int position, const void *data, int length);
|
||||
int bindStatic(int position, const std::vector<unsigned char>& value);
|
||||
int bindStatic(int position, Blob const& value);
|
||||
|
||||
int bind(int position, const std::string& value);
|
||||
int bindStatic(int position, const std::string& value);
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
int size(int column);
|
||||
|
||||
const void* peekBlob(int column);
|
||||
std::vector<unsigned char> getBlob(int column);
|
||||
Blob getBlob(int column);
|
||||
|
||||
std::string getString(int column);
|
||||
const char* peekString(int column);
|
||||
|
||||
@@ -86,7 +86,7 @@ int Database::getBinary(const char* colName,unsigned char* buf,int maxSize)
|
||||
return(0);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> Database::getBinary(const std::string& strColName)
|
||||
Blob Database::getBinary(const std::string& strColName)
|
||||
{
|
||||
int index;
|
||||
|
||||
@@ -95,7 +95,7 @@ std::vector<unsigned char> Database::getBinary(const std::string& strColName)
|
||||
return getBinary(index);
|
||||
}
|
||||
|
||||
return std::vector<unsigned char>();
|
||||
return Blob ();
|
||||
}
|
||||
|
||||
std::string Database::getStrBinary(const std::string& strColName)
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
// returns amount stored in buf
|
||||
int getBinary(const char* colName, unsigned char* buf, int maxSize);
|
||||
std::vector<unsigned char> getBinary(const std::string& strColName);
|
||||
Blob getBinary(const std::string& strColName);
|
||||
|
||||
uint64 getBigInt(const char* colName);
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
virtual bool getBool(int colIndex)=0;
|
||||
virtual int getBinary(int colIndex,unsigned char* buf,int maxSize)=0;
|
||||
virtual uint64 getBigInt(int colIndex)=0;
|
||||
virtual std::vector<unsigned char> getBinary(int colIndex)=0;
|
||||
virtual Blob getBinary(int colIndex)=0;
|
||||
|
||||
// int getSingleDBValueInt(const char* sql);
|
||||
// float getSingleDBValueFloat(const char* sql);
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
TransactionMetaSet::pointer mMeta;
|
||||
TER mResult;
|
||||
std::vector<RippleAddress> mAffected;
|
||||
std::vector<unsigned char> mRawMeta;
|
||||
Blob mRawMeta;
|
||||
Json::Value mJson;
|
||||
|
||||
void buildJson();
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; }
|
||||
SerializedLedgerEntry& peekSLE() { return *mLedgerEntry; }
|
||||
|
||||
std::vector<unsigned char> getRaw() const;
|
||||
Blob getRaw() const;
|
||||
|
||||
// VFALCO TODO make an accessor for mLedgerEntry so we can change protected to private
|
||||
protected:
|
||||
|
||||
@@ -148,7 +148,7 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if (mTxn.isFieldPresent(sfMessageKey))
|
||||
{
|
||||
std::vector<unsigned char> vucPublic = mTxn.getFieldVL(sfMessageKey);
|
||||
Blob vucPublic = mTxn.getFieldVL(sfMessageKey);
|
||||
|
||||
if (vucPublic.size() > PUBLIC_BYTES_MAX)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if (mTxn.isFieldPresent(sfDomain))
|
||||
{
|
||||
std::vector<unsigned char> vucDomain = mTxn.getFieldVL(sfDomain);
|
||||
Blob vucDomain = mTxn.getFieldVL(sfDomain);
|
||||
|
||||
if (vucDomain.empty())
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ AccountState::AccountState(SLE::ref ledgerEntry, const RippleAddress& naAccountI
|
||||
|
||||
std::string AccountState::createGravatarUrl(uint128 uEmailHash)
|
||||
{
|
||||
std::vector<unsigned char> vucMD5(uEmailHash.begin(), uEmailHash.end());
|
||||
Blob vucMD5(uEmailHash.begin(), uEmailHash.end());
|
||||
std::string strMD5Lower = strHex(vucMD5);
|
||||
boost::to_lower(strMD5Lower);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; }
|
||||
SerializedLedgerEntry& peekSLE() { return *mLedgerEntry; }
|
||||
|
||||
std::vector<unsigned char> getRaw() const;
|
||||
Blob getRaw() const;
|
||||
void addJson(Json::Value& value);
|
||||
void dump();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class IPeers;
|
||||
class RPCDoor;
|
||||
class PeerDoor;
|
||||
|
||||
typedef TaggedCache <uint256, std::vector <unsigned char>, UptimeTimerAdapter> NodeCache;
|
||||
typedef TaggedCache <uint256, Blob , UptimeTimerAdapter> NodeCache;
|
||||
typedef TaggedCache <uint256, SLE, UptimeTimerAdapter> SLECache;
|
||||
|
||||
class Application
|
||||
|
||||
@@ -111,7 +111,7 @@ bool Interpreter::endBlock()
|
||||
return(true);
|
||||
}
|
||||
|
||||
TER Interpreter::interpret(Contract* contract,const SerializedTransaction& txn,std::vector<unsigned char>& code)
|
||||
TER Interpreter::interpret(Contract* contract,const SerializedTransaction& txn,Blob & code)
|
||||
{
|
||||
mContract=contract;
|
||||
mCode=&code;
|
||||
|
||||
@@ -13,7 +13,7 @@ class Interpreter
|
||||
std::vector<Data::pointer> mStack;
|
||||
|
||||
Contract* mContract;
|
||||
std::vector<unsigned char>* mCode;
|
||||
Blob * mCode;
|
||||
unsigned int mInstructionPointer;
|
||||
int mTotalFee;
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
Interpreter();
|
||||
|
||||
// returns a TransactionEngineResult
|
||||
TER interpret(Contract* contract,const SerializedTransaction& txn,std::vector<unsigned char>& code);
|
||||
TER interpret(Contract* contract,const SerializedTransaction& txn,Blob & code);
|
||||
|
||||
void stop();
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ Ledger::Ledger(bool /* dummy */, Ledger& prevLedger) :
|
||||
zeroFees();
|
||||
}
|
||||
|
||||
Ledger::Ledger(const std::vector<unsigned char>& rawLedger, bool hasPrefix) :
|
||||
Ledger::Ledger(Blob const& rawLedger, bool hasPrefix) :
|
||||
mClosed(false), mValidHash(false), mAccepted(false), mImmutable(true)
|
||||
{
|
||||
Serializer s(rawLedger);
|
||||
@@ -272,7 +272,7 @@ Transaction::pointer Ledger::getTransaction(const uint256& transID) const
|
||||
txn = Transaction::sharedTransaction(item->getData(), true);
|
||||
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
{
|
||||
std::vector<unsigned char> txnData;
|
||||
Blob txnData;
|
||||
int txnLength;
|
||||
if (!item->peekSerializer().getVL(txnData, 0, txnLength))
|
||||
return Transaction::pointer();
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
uint64 totCoins, uint32 closeTime, uint32 parentCloseTime, int closeFlags, int closeResolution,
|
||||
uint32 ledgerSeq, bool& loaded); // used for database ledgers
|
||||
|
||||
Ledger(const std::vector<unsigned char>& rawLedger, bool hasPrefix);
|
||||
Ledger(Blob const& rawLedger, bool hasPrefix);
|
||||
Ledger(const std::string& rawLedger, bool hasPrefix);
|
||||
|
||||
Ledger(bool dummy, Ledger& previous); // ledger after this one
|
||||
|
||||
@@ -116,7 +116,7 @@ bool LedgerAcquire::tryLocal()
|
||||
HashedObject::pointer node = theApp->getHashedObjectStore().retrieve(mHash);
|
||||
if (!node)
|
||||
{
|
||||
std::vector<unsigned char> data;
|
||||
Blob data;
|
||||
if (!theApp->getOPs().getFetchPack(mHash, data))
|
||||
return false;
|
||||
WriteLog (lsTRACE, LedgerAcquire) << "Ledger base found in fetch pack";
|
||||
@@ -672,7 +672,7 @@ bool LedgerAcquire::takeBase(const std::string& data) // data must not have hash
|
||||
}
|
||||
|
||||
bool LedgerAcquire::takeTxNode(const std::list<SHAMapNode>& nodeIDs,
|
||||
const std::list< std::vector<unsigned char> >& data, SMAddNode& san)
|
||||
const std::list< Blob >& data, SMAddNode& san)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
if (!mHaveBase)
|
||||
@@ -681,7 +681,7 @@ bool LedgerAcquire::takeTxNode(const std::list<SHAMapNode>& nodeIDs,
|
||||
return true;
|
||||
|
||||
std::list<SHAMapNode>::const_iterator nodeIDit = nodeIDs.begin();
|
||||
std::list< std::vector<unsigned char> >::const_iterator nodeDatait = data.begin();
|
||||
std::list< Blob >::const_iterator nodeDatait = data.begin();
|
||||
TransactionStateSF tFilter(mLedger->getLedgerSeq());
|
||||
while (nodeIDit != nodeIDs.end())
|
||||
{
|
||||
@@ -713,7 +713,7 @@ bool LedgerAcquire::takeTxNode(const std::list<SHAMapNode>& nodeIDs,
|
||||
}
|
||||
|
||||
bool LedgerAcquire::takeAsNode(const std::list<SHAMapNode>& nodeIDs,
|
||||
const std::list< std::vector<unsigned char> >& data, SMAddNode& san)
|
||||
const std::list< Blob >& data, SMAddNode& san)
|
||||
{
|
||||
WriteLog (lsTRACE, LedgerAcquire) << "got ASdata (" << nodeIDs.size() <<") acquiring ledger " << mHash;
|
||||
CondLog (nodeIDs.size() == 1, lsTRACE, LedgerAcquire) << "got AS node: " << nodeIDs.front();
|
||||
@@ -728,7 +728,7 @@ bool LedgerAcquire::takeAsNode(const std::list<SHAMapNode>& nodeIDs,
|
||||
return true;
|
||||
|
||||
std::list<SHAMapNode>::const_iterator nodeIDit = nodeIDs.begin();
|
||||
std::list< std::vector<unsigned char> >::const_iterator nodeDatait = data.begin();
|
||||
std::list< Blob >::const_iterator nodeDatait = data.begin();
|
||||
AccountStateSF tFilter(mLedger->getLedgerSeq());
|
||||
while (nodeIDit != nodeIDs.end())
|
||||
{
|
||||
@@ -762,7 +762,7 @@ bool LedgerAcquire::takeAsNode(const std::list<SHAMapNode>& nodeIDs,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LedgerAcquire::takeAsRootNode(const std::vector<unsigned char>& data, SMAddNode& san)
|
||||
bool LedgerAcquire::takeAsRootNode(Blob const& data, SMAddNode& san)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
if (mFailed || mHaveState)
|
||||
@@ -774,7 +774,7 @@ bool LedgerAcquire::takeAsRootNode(const std::vector<unsigned char>& data, SMAdd
|
||||
mLedger->peekAccountStateMap()->addRootNode(mLedger->getAccountHash(), data, snfWIRE, &tFilter));
|
||||
}
|
||||
|
||||
bool LedgerAcquire::takeTxRootNode(const std::vector<unsigned char>& data, SMAddNode& san)
|
||||
bool LedgerAcquire::takeTxRootNode(Blob const& data, SMAddNode& san)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
if (mFailed || mHaveState)
|
||||
@@ -964,7 +964,7 @@ void LedgerAcquireMaster::gotLedgerData(Job&, uint256 hash,
|
||||
if ((packet.type() == ripple::liTX_NODE) || (packet.type() == ripple::liAS_NODE))
|
||||
{
|
||||
std::list<SHAMapNode> nodeIDs;
|
||||
std::list< std::vector<unsigned char> > nodeData;
|
||||
std::list< Blob > nodeData;
|
||||
|
||||
if (packet.nodes().size() <= 0)
|
||||
{
|
||||
@@ -983,7 +983,7 @@ void LedgerAcquireMaster::gotLedgerData(Job&, uint256 hash,
|
||||
}
|
||||
|
||||
nodeIDs.push_back(SHAMapNode(node.nodeid().data(), node.nodeid().size()));
|
||||
nodeData.push_back(std::vector<unsigned char>(node.nodedata().begin(), node.nodedata().end()));
|
||||
nodeData.push_back(Blob (node.nodedata().begin(), node.nodedata().end()));
|
||||
}
|
||||
SMAddNode ret;
|
||||
if (packet.type() == ripple::liTX_NODE)
|
||||
|
||||
@@ -115,12 +115,12 @@ public:
|
||||
bool addOnComplete(FUNCTION_TYPE<void (LedgerAcquire::pointer)>);
|
||||
|
||||
bool takeBase(const std::string& data);
|
||||
bool takeTxNode(const std::list<SHAMapNode>& IDs, const std::list<std::vector<unsigned char> >& data,
|
||||
bool takeTxNode(const std::list<SHAMapNode>& IDs, const std::list<Blob >& data,
|
||||
SMAddNode&);
|
||||
bool takeTxRootNode(const std::vector<unsigned char>& data, SMAddNode&);
|
||||
bool takeAsNode(const std::list<SHAMapNode>& IDs, const std::list<std::vector<unsigned char> >& data,
|
||||
bool takeTxRootNode(Blob const& data, SMAddNode&);
|
||||
bool takeAsNode(const std::list<SHAMapNode>& IDs, const std::list<Blob >& data,
|
||||
SMAddNode&);
|
||||
bool takeAsRootNode(const std::vector<unsigned char>& data, SMAddNode&);
|
||||
bool takeAsRootNode(Blob const& data, SMAddNode&);
|
||||
void trigger(Peer::ref);
|
||||
bool tryLocal();
|
||||
void addPeers();
|
||||
|
||||
@@ -190,7 +190,7 @@ void LedgerConsensus::checkOurValidation()
|
||||
v->sign(signingHash, mValPrivate);
|
||||
theApp->getHashRouter ().addSuppression (signingHash);
|
||||
theApp->getValidations().addValidation(v, "localMissing");
|
||||
std::vector<unsigned char> validation = v->getSigned();
|
||||
Blob validation = v->getSigned();
|
||||
ripple::TMValidation val;
|
||||
val.set_validation(&validation[0], validation.size());
|
||||
#if 0
|
||||
@@ -824,15 +824,15 @@ void LedgerConsensus::propose()
|
||||
prop.set_proposeseq(mOurPosition->getProposeSeq());
|
||||
prop.set_closetime(mOurPosition->getCloseTime());
|
||||
|
||||
std::vector<unsigned char> pubKey = mOurPosition->getPubKey();
|
||||
std::vector<unsigned char> sig = mOurPosition->sign();
|
||||
Blob pubKey = mOurPosition->getPubKey();
|
||||
Blob sig = mOurPosition->sign();
|
||||
prop.set_nodepubkey(&pubKey[0], pubKey.size());
|
||||
prop.set_signature(&sig[0], sig.size());
|
||||
theApp->getPeers().relayMessage(NULL,
|
||||
boost::make_shared<PackedMessage>(prop, ripple::mtPROPOSE_LEDGER));
|
||||
}
|
||||
|
||||
void LedgerConsensus::addDisputedTransaction(const uint256& txID, const std::vector<unsigned char>& tx)
|
||||
void LedgerConsensus::addDisputedTransaction(const uint256& txID, Blob const& tx)
|
||||
{
|
||||
if (mDisputes.find(txID) != mDisputes.end())
|
||||
return;
|
||||
@@ -945,7 +945,7 @@ bool LedgerConsensus::peerHasSet(Peer::ref peer, const uint256& hashSet, ripple:
|
||||
}
|
||||
|
||||
SMAddNode LedgerConsensus::peerGaveNodes(Peer::ref peer, const uint256& setHash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData)
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< Blob >& nodeData)
|
||||
{
|
||||
boost::unordered_map<uint256, TransactionAcquire::pointer>::iterator acq = mAcquiring.find(setHash);
|
||||
if (acq == mAcquiring.end())
|
||||
@@ -1227,7 +1227,7 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer)
|
||||
theApp->getHashRouter ().addSuppression (signingHash); // suppress it if we receive it
|
||||
theApp->getValidations().addValidation(v, "local");
|
||||
theApp->getOPs().setLastValidation(v);
|
||||
std::vector<unsigned char> validation = v->getSigned();
|
||||
Blob validation = v->getSigned();
|
||||
ripple::TMValidation val;
|
||||
val.set_validation(&validation[0], validation.size());
|
||||
int j = theApp->getPeers().relayMessage(NULL,
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
SHAMap::ref getMap() { return mMap; }
|
||||
|
||||
SMAddNode takeNodes(const std::list<SHAMapNode>& IDs,
|
||||
const std::list< std::vector<unsigned char> >& data, Peer::ref);
|
||||
const std::list< Blob >& data, Peer::ref);
|
||||
|
||||
private:
|
||||
SHAMap::pointer mMap;
|
||||
@@ -53,7 +53,7 @@ class LCTransaction
|
||||
public:
|
||||
typedef boost::shared_ptr<LCTransaction> pointer;
|
||||
|
||||
LCTransaction(const uint256 &txID, const std::vector<unsigned char>& tx, bool ourVote) :
|
||||
LCTransaction(const uint256 &txID, Blob const& tx, bool ourVote) :
|
||||
mTransactionID(txID), mYays(0), mNays(0), mOurVote(ourVote), transaction(tx) { ; }
|
||||
|
||||
const uint256& getTransactionID() const { return mTransactionID; }
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
bool peerHasSet(Peer::ref peer, const uint256& set, ripple::TxSetStatus status);
|
||||
|
||||
SMAddNode peerGaveNodes(Peer::ref peer, const uint256& setHash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData);
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< Blob >& nodeData);
|
||||
|
||||
bool isOurPubKey(const RippleAddress &k) { return k == mValPublic; }
|
||||
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
SHAMap::pointer find(const uint256& hash);
|
||||
|
||||
void createDisputes(SHAMap::ref, SHAMap::ref);
|
||||
void addDisputedTransaction(const uint256&, const std::vector<unsigned char>& transaction);
|
||||
void addDisputedTransaction(const uint256&, Blob const& transaction);
|
||||
void adjustCount(SHAMap::ref map, const std::vector<uint160>& peers);
|
||||
void propose();
|
||||
|
||||
|
||||
@@ -66,9 +66,9 @@ void LedgerProposal::bowOut()
|
||||
mProposeSeq = seqLeave;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> LedgerProposal::sign(void)
|
||||
Blob LedgerProposal::sign(void)
|
||||
{
|
||||
std::vector<unsigned char> ret;
|
||||
Blob ret;
|
||||
|
||||
mPrivateKey.signNodePrivate(getSigningHash(), ret);
|
||||
// XXX If this can fail, find out sooner.
|
||||
|
||||
@@ -40,8 +40,8 @@ public:
|
||||
uint32 getProposeSeq() const { return mProposeSeq; }
|
||||
uint32 getCloseTime() const { return mCloseTime; }
|
||||
const RippleAddress& peekPublic() const { return mPublicKey; }
|
||||
std::vector<unsigned char> getPubKey() const { return mPublicKey.getNodePublic(); }
|
||||
std::vector<unsigned char> sign();
|
||||
Blob getPubKey() const { return mPublicKey.getNodePublic(); }
|
||||
Blob sign();
|
||||
|
||||
void setPrevLedger(const uint256& prevLedger) { mPreviousLedger = prevLedger; }
|
||||
void setSignature(const std::string& signature) { mSignature = signature; }
|
||||
|
||||
@@ -958,7 +958,7 @@ void NetworkOPs::takePosition(int seq, SHAMap::ref position)
|
||||
}
|
||||
|
||||
SMAddNode NetworkOPs::gotTXData(const boost::shared_ptr<Peer>& peer, const uint256& hash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData)
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< Blob >& nodeData)
|
||||
{
|
||||
if (!haveConsensusObject())
|
||||
{
|
||||
@@ -1164,7 +1164,7 @@ std::vector<NetworkOPs::txnMetaLedgerType> NetworkOPs::getAccountTxsB(
|
||||
SQL_FOREACH(db, sql)
|
||||
{
|
||||
int txnSize = 2048;
|
||||
std::vector<unsigned char> rawTxn(txnSize);
|
||||
Blob rawTxn(txnSize);
|
||||
txnSize = db->getBinary("RawTxn", &rawTxn[0], rawTxn.size());
|
||||
if (txnSize > rawTxn.size())
|
||||
{
|
||||
@@ -1175,7 +1175,7 @@ std::vector<NetworkOPs::txnMetaLedgerType> NetworkOPs::getAccountTxsB(
|
||||
rawTxn.resize(txnSize);
|
||||
|
||||
int metaSize = 2048;
|
||||
std::vector<unsigned char> rawMeta(metaSize);
|
||||
Blob rawMeta(metaSize);
|
||||
metaSize = db->getBinary("TxnMeta", &rawMeta[0], rawMeta.size());
|
||||
if (metaSize > rawMeta.size())
|
||||
{
|
||||
@@ -2095,12 +2095,12 @@ void NetworkOPs::sweepFetchPack()
|
||||
mFetchPack.sweep();
|
||||
}
|
||||
|
||||
void NetworkOPs::addFetchPack(const uint256& hash, boost::shared_ptr< std::vector<unsigned char> >& data)
|
||||
void NetworkOPs::addFetchPack(const uint256& hash, boost::shared_ptr< Blob >& data)
|
||||
{
|
||||
mFetchPack.canonicalize(hash, data, false);
|
||||
}
|
||||
|
||||
bool NetworkOPs::getFetchPack(const uint256& hash, std::vector<unsigned char>& data)
|
||||
bool NetworkOPs::getFetchPack(const uint256& hash, Blob & data)
|
||||
{
|
||||
bool ret = mFetchPack.retrieve(hash, data);
|
||||
if (!ret)
|
||||
|
||||
@@ -210,22 +210,22 @@ public:
|
||||
Json::Value& jvResult);
|
||||
|
||||
// raw object operations
|
||||
bool findRawLedger(const uint256& ledgerHash, std::vector<unsigned char>& rawLedger);
|
||||
bool findRawTransaction(const uint256& transactionHash, std::vector<unsigned char>& rawTransaction);
|
||||
bool findAccountNode(const uint256& nodeHash, std::vector<unsigned char>& rawAccountNode);
|
||||
bool findTransactionNode(const uint256& nodeHash, std::vector<unsigned char>& rawTransactionNode);
|
||||
bool findRawLedger(const uint256& ledgerHash, Blob & rawLedger);
|
||||
bool findRawTransaction(const uint256& transactionHash, Blob & rawTransaction);
|
||||
bool findAccountNode(const uint256& nodeHash, Blob & rawAccountNode);
|
||||
bool findTransactionNode(const uint256& nodeHash, Blob & rawTransactionNode);
|
||||
|
||||
// tree synchronization operations
|
||||
bool getTransactionTreeNodes(uint32 ledgerSeq, const uint256& myNodeID,
|
||||
const std::vector<unsigned char>& myNode, std::list< std::vector<unsigned char> >& newNodes);
|
||||
Blob const& myNode, std::list< Blob >& newNodes);
|
||||
bool getAccountStateNodes(uint32 ledgerSeq, const uint256& myNodeId,
|
||||
const std::vector<unsigned char>& myNode, std::list< std::vector<unsigned char> >& newNodes);
|
||||
Blob const& myNode, std::list< Blob >& newNodes);
|
||||
|
||||
// ledger proposal/close functions
|
||||
void processTrustedProposal(LedgerProposal::pointer proposal, boost::shared_ptr<ripple::TMProposeSet> set,
|
||||
RippleAddress nodePublic, uint256 checkLedger, bool sigGood);
|
||||
SMAddNode gotTXData(const boost::shared_ptr<Peer>& peer, const uint256& hash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData);
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< Blob >& nodeData);
|
||||
bool recvValidation(SerializedValidation::ref val, const std::string& source);
|
||||
void takePosition(int seq, SHAMap::ref position);
|
||||
SHAMap::pointer getTXMap(const uint256& hash);
|
||||
@@ -236,8 +236,8 @@ public:
|
||||
Ledger::pointer wantLedger, Ledger::pointer haveLedger, uint32 uUptime);
|
||||
bool shouldFetchPack(uint32 seq);
|
||||
void gotFetchPack(bool progress, uint32 seq);
|
||||
void addFetchPack(const uint256& hash, boost::shared_ptr< std::vector<unsigned char> >& data);
|
||||
bool getFetchPack(const uint256& hash, std::vector<unsigned char>& data);
|
||||
void addFetchPack(const uint256& hash, boost::shared_ptr< Blob >& data);
|
||||
bool getFetchPack(const uint256& hash, Blob & data);
|
||||
int getFetchSize();
|
||||
void sweepFetchPack();
|
||||
|
||||
@@ -368,7 +368,7 @@ private:
|
||||
subMapType mSubTransactions; // all accepted transactions
|
||||
subMapType mSubRTTransactions; // all proposed and accepted transactions
|
||||
|
||||
TaggedCache< uint256, std::vector<unsigned char>, UptimeTimerAdapter > mFetchPack;
|
||||
TaggedCache< uint256, Blob , UptimeTimerAdapter > mFetchPack;
|
||||
uint32 mLastFetchPack;
|
||||
uint32 mFetchSeq;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; }
|
||||
SerializedLedgerEntry& peekSLE() { return *mLedgerEntry; }
|
||||
|
||||
std::vector<unsigned char> getRaw() const;
|
||||
Blob getRaw() const;
|
||||
void addJson(Json::Value& value);
|
||||
};
|
||||
|
||||
|
||||
@@ -389,8 +389,8 @@ Json::Value RPCHandler::getMasterGenerator(Ledger::ref lrLedger, const RippleAdd
|
||||
return rpcError(rpcNO_ACCOUNT);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> vucCipher = sleGen->getFieldVL(sfGenerator);
|
||||
std::vector<unsigned char> vucMasterGenerator = na0Private.accountPrivateDecrypt(na0Public, vucCipher);
|
||||
Blob vucCipher = sleGen->getFieldVL(sfGenerator);
|
||||
Blob vucMasterGenerator = na0Private.accountPrivateDecrypt(na0Public, vucCipher);
|
||||
if (vucMasterGenerator.empty())
|
||||
{
|
||||
return rpcError(rpcFAIL_GEN_DECRPYT);
|
||||
@@ -543,8 +543,8 @@ Json::Value RPCHandler::accountFromString(Ledger::ref lrLedger, RippleAddress& n
|
||||
else
|
||||
{
|
||||
// Found master public key.
|
||||
std::vector<unsigned char> vucCipher = sleGen->getFieldVL(sfGenerator);
|
||||
std::vector<unsigned char> vucMasterGenerator = naRegular0Private.accountPrivateDecrypt(naRegular0Public, vucCipher);
|
||||
Blob vucCipher = sleGen->getFieldVL(sfGenerator);
|
||||
Blob vucMasterGenerator = naRegular0Private.accountPrivateDecrypt(naRegular0Public, vucCipher);
|
||||
if (vucMasterGenerator.empty())
|
||||
{
|
||||
rpcError(rpcNO_GEN_DECRPYT);
|
||||
@@ -1590,7 +1590,7 @@ Json::Value RPCHandler::doSubmit(Json::Value jvRequest, int& cost, ScopedLock& M
|
||||
|
||||
Json::Value jvResult;
|
||||
|
||||
std::vector<unsigned char> vucBlob(strUnHex(jvRequest["tx_blob"].asString()));
|
||||
Blob vucBlob(strUnHex(jvRequest["tx_blob"].asString()));
|
||||
|
||||
if (!vucBlob.size())
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ private:
|
||||
boost::asio::ip::tcp::socket mSocket;
|
||||
|
||||
boost::asio::streambuf mLineBuffer;
|
||||
std::vector<unsigned char> mQueryVec;
|
||||
Blob mQueryVec;
|
||||
std::string mReplyStr;
|
||||
|
||||
HTTPRequest mHTTPRequest;
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
SerializedLedgerEntry& peekSLE() { return *mLedgerEntry; }
|
||||
Json::Value getJson(int);
|
||||
|
||||
std::vector<unsigned char> getRaw() const;
|
||||
Blob getRaw() const;
|
||||
};
|
||||
#endif
|
||||
// vim:ts=4
|
||||
|
||||
@@ -230,7 +230,7 @@ SHAMapTreeNode* SHAMap::getNodePointer(const SHAMapNode& id, const uint256& hash
|
||||
{
|
||||
if (filter)
|
||||
{
|
||||
std::vector<unsigned char> nodeData;
|
||||
Blob nodeData;
|
||||
if (filter->haveNode(id, hash, nodeData))
|
||||
{
|
||||
SHAMapTreeNode::pointer node = boost::make_shared<SHAMapTreeNode>(
|
||||
@@ -270,7 +270,7 @@ void SHAMap::trackNewNode(SHAMapTreeNode::pointer& node)
|
||||
(*mDirtyNodes)[*node] = node;
|
||||
}
|
||||
|
||||
SHAMapItem::SHAMapItem(const uint256& tag, const std::vector<unsigned char>& data)
|
||||
SHAMapItem::SHAMapItem(const uint256& tag, Blob const& data)
|
||||
: mTag(tag), mData(data)
|
||||
{ ; }
|
||||
|
||||
@@ -773,7 +773,7 @@ void SHAMap::fetchRoot(const uint256& hash, SHAMapSyncFilter* filter)
|
||||
}
|
||||
catch (SHAMapMissingNode&)
|
||||
{
|
||||
std::vector<unsigned char> nodeData;
|
||||
Blob nodeData;
|
||||
if (!filter || !filter->haveNode(SHAMapNode(), hash, nodeData))
|
||||
throw;
|
||||
root = boost::make_shared<SHAMapTreeNode>(SHAMapNode(), nodeData,
|
||||
@@ -850,7 +850,7 @@ SHAMapTreeNode::pointer SHAMap::getNode(const SHAMapNode& nodeID)
|
||||
return node;
|
||||
}
|
||||
|
||||
bool SHAMap::getPath(const uint256& index, std::vector< std::vector<unsigned char> >& nodes, SHANodeFormat format)
|
||||
bool SHAMap::getPath(const uint256& index, std::vector< Blob >& nodes, SHANodeFormat format)
|
||||
{
|
||||
// Return the path of nodes to the specified index in the specified format
|
||||
// Return value: true = node present, false = node not present
|
||||
@@ -912,9 +912,9 @@ void SHAMap::dump(bool hash)
|
||||
|
||||
}
|
||||
|
||||
static std::vector<unsigned char>IntToVUC(int v)
|
||||
static Blob IntToVUC(int v)
|
||||
{
|
||||
std::vector<unsigned char> vuc;
|
||||
Blob vuc;
|
||||
for (int i = 0; i < 32; ++i)
|
||||
vuc.push_back(static_cast<unsigned char>(v));
|
||||
return vuc;
|
||||
|
||||
@@ -93,17 +93,17 @@ private:
|
||||
public:
|
||||
|
||||
SHAMapItem(const uint256& tag) : mTag(tag) { ; }
|
||||
SHAMapItem(const uint256& tag, const std::vector<unsigned char>& data);
|
||||
SHAMapItem(const uint256& tag, Blob const& data);
|
||||
SHAMapItem(const uint256& tag, const Serializer& s);
|
||||
SHAMapItem(const std::vector<unsigned char>& data); // tag by hash
|
||||
SHAMapItem(Blob const& data); // tag by hash
|
||||
|
||||
const uint256& getTag() const { return mTag; }
|
||||
std::vector<unsigned char> getData() const { return mData.getData(); }
|
||||
const std::vector<unsigned char>& peekData() const { return mData.peekData(); }
|
||||
Blob getData() const { return mData.getData(); }
|
||||
Blob const& peekData() const { return mData.peekData(); }
|
||||
Serializer& peekSerializer() { return mData; }
|
||||
void addRaw(std::vector<unsigned char>& s) const { s.insert(s.end(), mData.begin(), mData.end()); }
|
||||
void addRaw(Blob & s) const { s.insert(s.end(), mData.begin(), mData.end()); }
|
||||
|
||||
void updateData(const std::vector<unsigned char>& data) { mData=data; }
|
||||
void updateData(Blob const& data) { mData=data; }
|
||||
|
||||
bool operator==(const SHAMapItem& i) const { return mTag == i.mTag; }
|
||||
bool operator!=(const SHAMapItem& i) const { return mTag != i.mTag; }
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
SHAMapTreeNode(const SHAMapNode& nodeID, SHAMapItem::ref item, TNType type, uint32 seq);
|
||||
|
||||
// raw node functions
|
||||
SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned char>& data, uint32 seq,
|
||||
SHAMapTreeNode(const SHAMapNode& id, Blob const& data, uint32 seq,
|
||||
SHANodeFormat format, const uint256& hash, bool hashValid);
|
||||
void addRaw(Serializer &, SHANodeFormat format);
|
||||
|
||||
@@ -216,8 +216,8 @@ public:
|
||||
SHAMapItem::pointer getItem() const;
|
||||
bool setItem(SHAMapItem::ref i, TNType type);
|
||||
const uint256& getTag() const { return mItem->getTag(); }
|
||||
const std::vector<unsigned char>& peekData() { return mItem->peekData(); }
|
||||
std::vector<unsigned char> getData() const { return mItem->getData(); }
|
||||
Blob const& peekData() { return mItem->peekData(); }
|
||||
Blob getData() const { return mItem->getData(); }
|
||||
|
||||
// sync functions
|
||||
bool isFullBelow(void) const { return mFullBelow; }
|
||||
@@ -243,10 +243,10 @@ public:
|
||||
virtual ~SHAMapSyncFilter() { ; }
|
||||
|
||||
virtual void gotNode(bool fromFilter, const SHAMapNode& id, const uint256& nodeHash,
|
||||
const std::vector<unsigned char>& nodeData, SHAMapTreeNode::TNType type)
|
||||
Blob const& nodeData, SHAMapTreeNode::TNType type)
|
||||
{ ; }
|
||||
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData)
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, Blob & nodeData)
|
||||
{ return false; }
|
||||
};
|
||||
|
||||
@@ -383,14 +383,14 @@ public:
|
||||
void getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint256>& hashes, int max,
|
||||
SHAMapSyncFilter* filter);
|
||||
bool getNodeFat(const SHAMapNode& node, std::vector<SHAMapNode>& nodeIDs,
|
||||
std::list<std::vector<unsigned char> >& rawNode, bool fatRoot, bool fatLeaves);
|
||||
std::list<Blob >& rawNode, bool fatRoot, bool fatLeaves);
|
||||
bool getRootNode(Serializer& s, SHANodeFormat format);
|
||||
std::vector<uint256> getNeededHashes(int max, SHAMapSyncFilter* filter);
|
||||
SMAddNode addRootNode(const uint256& hash, const std::vector<unsigned char>& rootNode, SHANodeFormat format,
|
||||
SMAddNode addRootNode(const uint256& hash, Blob const& rootNode, SHANodeFormat format,
|
||||
SHAMapSyncFilter* filter);
|
||||
SMAddNode addRootNode(const std::vector<unsigned char>& rootNode, SHANodeFormat format,
|
||||
SMAddNode addRootNode(Blob const& rootNode, SHANodeFormat format,
|
||||
SHAMapSyncFilter* filter);
|
||||
SMAddNode addKnownNode(const SHAMapNode& nodeID, const std::vector<unsigned char>& rawNode,
|
||||
SMAddNode addKnownNode(const SHAMapNode& nodeID, Blob const& rawNode,
|
||||
SHAMapSyncFilter* filter);
|
||||
|
||||
// status functions
|
||||
@@ -419,18 +419,18 @@ public:
|
||||
bool operator==(const SHAMap& s) { return getHash() == s.getHash(); }
|
||||
|
||||
// trusted path operations - prove a particular node is in a particular ledger
|
||||
std::list<std::vector<unsigned char> > getTrustedPath(const uint256& index);
|
||||
static std::vector<unsigned char> checkTrustedPath(const uint256& ledgerHash, const uint256& leafIndex,
|
||||
const std::list<std::vector<unsigned char> >& path);
|
||||
std::list<Blob > getTrustedPath(const uint256& index);
|
||||
static Blob checkTrustedPath(const uint256& ledgerHash, const uint256& leafIndex,
|
||||
const std::list<Blob >& path);
|
||||
|
||||
void walkMap(std::vector<SHAMapMissingNode>& missingNodes, int maxMissing);
|
||||
|
||||
bool getPath(const uint256& index, std::vector< std::vector<unsigned char> >& nodes, SHANodeFormat format);
|
||||
bool getPath(const uint256& index, std::vector< Blob >& nodes, SHANodeFormat format);
|
||||
|
||||
bool deepCompare(SHAMap& other);
|
||||
virtual void dump(bool withHashes = false);
|
||||
|
||||
typedef std::pair< uint256, std::vector<unsigned char> > fetchPackEntry_t;
|
||||
typedef std::pair< uint256, Blob > fetchPackEntry_t;
|
||||
std::list<fetchPackEntry_t> getFetchPack(SHAMap* have, bool includeLeaves, int max);
|
||||
|
||||
static void sweep() { fullBelowCache.sweep(); }
|
||||
|
||||
@@ -159,7 +159,7 @@ SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& node, SHAMapItem::ref item, TNT
|
||||
updateHash();
|
||||
}
|
||||
|
||||
SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned char>& rawNode, uint32 seq,
|
||||
SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& id, Blob const& rawNode, uint32 seq,
|
||||
SHANodeFormat format, const uint256& hash, bool hashValid) :
|
||||
SHAMapNode(id), mSeq(seq), mType(tnERROR), mIsBranch(0), mFullBelow(false)
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ std::vector<uint256> SHAMap::getNeededHashes(int max, SHAMapSyncFilter* filter)
|
||||
}
|
||||
|
||||
bool SHAMap::getNodeFat(const SHAMapNode& wanted, std::vector<SHAMapNode>& nodeIDs,
|
||||
std::list<std::vector<unsigned char> >& rawNodes, bool fatRoot, bool fatLeaves)
|
||||
std::list<Blob >& rawNodes, bool fatRoot, bool fatLeaves)
|
||||
{ // Gets a node and some of its children
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
|
||||
@@ -203,7 +203,7 @@ bool SHAMap::getRootNode(Serializer& s, SHANodeFormat format)
|
||||
return true;
|
||||
}
|
||||
|
||||
SMAddNode SHAMap::addRootNode(const std::vector<unsigned char>& rootNode, SHANodeFormat format,
|
||||
SMAddNode SHAMap::addRootNode(Blob const& rootNode, SHANodeFormat format,
|
||||
SHAMapSyncFilter* filter)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
@@ -242,7 +242,7 @@ SMAddNode SHAMap::addRootNode(const std::vector<unsigned char>& rootNode, SHANod
|
||||
return SMAddNode::useful();
|
||||
}
|
||||
|
||||
SMAddNode SHAMap::addRootNode(const uint256& hash, const std::vector<unsigned char>& rootNode, SHANodeFormat format,
|
||||
SMAddNode SHAMap::addRootNode(const uint256& hash, Blob const& rootNode, SHANodeFormat format,
|
||||
SHAMapSyncFilter* filter)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
@@ -278,7 +278,7 @@ SMAddNode SHAMap::addRootNode(const uint256& hash, const std::vector<unsigned ch
|
||||
return SMAddNode::useful();
|
||||
}
|
||||
|
||||
SMAddNode SHAMap::addKnownNode(const SHAMapNode& node, const std::vector<unsigned char>& rawNode,
|
||||
SMAddNode SHAMap::addKnownNode(const SHAMapNode& node, Blob const& rawNode,
|
||||
SHAMapSyncFilter* filter)
|
||||
{ // return value: true=okay, false=error
|
||||
assert(!node.isRoot());
|
||||
@@ -562,7 +562,7 @@ static bool confuseMap(SHAMap &map, int count)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::list<std::vector<unsigned char> > SHAMap::getTrustedPath(const uint256& index)
|
||||
std::list<Blob > SHAMap::getTrustedPath(const uint256& index)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
std::stack<SHAMapTreeNode::pointer> stack = SHAMap::getStack(index, false, false);
|
||||
@@ -570,7 +570,7 @@ std::list<std::vector<unsigned char> > SHAMap::getTrustedPath(const uint256& ind
|
||||
if (stack.empty() || !stack.top()->isLeaf())
|
||||
throw std::runtime_error("requested leaf not present");
|
||||
|
||||
std::list< std::vector<unsigned char> > path;
|
||||
std::list< Blob > path;
|
||||
Serializer s;
|
||||
while (!stack.empty())
|
||||
{
|
||||
@@ -608,11 +608,11 @@ BOOST_AUTO_TEST_CASE( SHAMapSync_test )
|
||||
WriteLog (lsTRACE, SHAMap) << "SOURCE COMPLETE, SYNCHING";
|
||||
|
||||
std::vector<SHAMapNode> nodeIDs, gotNodeIDs;
|
||||
std::list< std::vector<unsigned char> > gotNodes;
|
||||
std::list< Blob > gotNodes;
|
||||
std::vector<uint256> hashes;
|
||||
|
||||
std::vector<SHAMapNode>::iterator nodeIDIterator;
|
||||
std::list< std::vector<unsigned char> >::iterator rawNodeIterator;
|
||||
std::list< Blob >::iterator rawNodeIterator;
|
||||
|
||||
int passes = 0;
|
||||
int nodes = 0;
|
||||
|
||||
@@ -14,9 +14,9 @@ public:
|
||||
ConsensusTransSetSF() { ; }
|
||||
|
||||
virtual void gotNode(bool fromFilter, const SHAMapNode& id, const uint256& nodeHash,
|
||||
const std::vector<unsigned char>& nodeData, SHAMapTreeNode::TNType);
|
||||
Blob const& nodeData, SHAMapTreeNode::TNType);
|
||||
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData);
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, Blob & nodeData);
|
||||
};
|
||||
|
||||
// This class is only needed on add functions
|
||||
@@ -28,11 +28,11 @@ public:
|
||||
{ ; }
|
||||
|
||||
virtual void gotNode(bool fromFilter, const SHAMapNode& id, const uint256& nodeHash,
|
||||
const std::vector<unsigned char>& nodeData, SHAMapTreeNode::TNType)
|
||||
Blob const& nodeData, SHAMapTreeNode::TNType)
|
||||
{
|
||||
theApp->getHashedObjectStore().store(hotACCOUNT_NODE, mLedgerSeq, nodeData, nodeHash);
|
||||
}
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData)
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, Blob & nodeData)
|
||||
{
|
||||
return theApp->getOPs().getFetchPack(nodeHash, nodeData);
|
||||
}
|
||||
@@ -50,13 +50,13 @@ public:
|
||||
{ ; }
|
||||
|
||||
virtual void gotNode(bool fromFilter, const SHAMapNode& id, const uint256& nodeHash,
|
||||
const std::vector<unsigned char>& nodeData, SHAMapTreeNode::TNType type)
|
||||
Blob const& nodeData, SHAMapTreeNode::TNType type)
|
||||
{
|
||||
theApp->getHashedObjectStore().store(
|
||||
(type == SHAMapTreeNode::tnTRANSACTION_NM) ? hotTRANSACTION : hotTRANSACTION_NODE,
|
||||
mLedgerSeq, nodeData, nodeHash);
|
||||
}
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData)
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, Blob & nodeData)
|
||||
{
|
||||
return theApp->getOPs().getFetchPack(nodeHash, nodeData);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ uint256 SerializedTransaction::getTransactionID() const
|
||||
return getHash(sHP_TransactionID);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> SerializedTransaction::getSignature() const
|
||||
Blob SerializedTransaction::getSignature() const
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -138,13 +138,13 @@ std::vector<unsigned char> SerializedTransaction::getSignature() const
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return std::vector<unsigned char>();
|
||||
return Blob ();
|
||||
}
|
||||
}
|
||||
|
||||
void SerializedTransaction::sign(const RippleAddress& naAccountPrivate)
|
||||
{
|
||||
std::vector<unsigned char> signature;
|
||||
Blob signature;
|
||||
naAccountPrivate.accountPrivateSign(getSigningHash(), signature);
|
||||
setFieldVL(sfTxnSignature, signature);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
std::string getText() const;
|
||||
|
||||
// outer transaction functions / signature functions
|
||||
std::vector<unsigned char> getSignature() const;
|
||||
void setSignature(const std::vector<unsigned char>& s) { setFieldVL(sfTxnSignature, s); }
|
||||
Blob getSignature() const;
|
||||
void setSignature(Blob const& s) { setFieldVL(sfTxnSignature, s); }
|
||||
uint256 getSigningHash() const;
|
||||
|
||||
TransactionType getTxnType() const { return mType; }
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
void setTransactionFee(const STAmount& fee) { setFieldAmount(sfFee, fee); }
|
||||
|
||||
RippleAddress getSourceAccount() const { return getFieldAccount(sfAccount); }
|
||||
std::vector<unsigned char> getSigningPubKey() const { return getFieldVL(sfSigningPubKey); }
|
||||
Blob getSigningPubKey() const { return getFieldVL(sfSigningPubKey); }
|
||||
void setSigningPubKey(const RippleAddress& naSignPubKey);
|
||||
void setSourceAccount(const RippleAddress& naSource);
|
||||
std::string getTransactionType() const { return mFormat->t_name; }
|
||||
|
||||
@@ -40,7 +40,7 @@ void SerializedValidation::sign(const RippleAddress& raPriv)
|
||||
void SerializedValidation::sign(uint256& signingHash, const RippleAddress& raPriv)
|
||||
{
|
||||
signingHash = getSigningHash();
|
||||
std::vector<unsigned char> signature;
|
||||
Blob signature;
|
||||
raPriv.signNodePrivate(signingHash, signature);
|
||||
setFieldVL(sfSignature, signature);
|
||||
}
|
||||
@@ -96,12 +96,12 @@ bool SerializedValidation::isFull() const
|
||||
return (getFlags() & sFullFlag) != 0;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> SerializedValidation::getSignature() const
|
||||
Blob SerializedValidation::getSignature() const
|
||||
{
|
||||
return getFieldVL(sfSignature);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> SerializedValidation::getSigned() const
|
||||
Blob SerializedValidation::getSigned() const
|
||||
{
|
||||
Serializer s;
|
||||
add(s);
|
||||
|
||||
@@ -31,8 +31,8 @@ public:
|
||||
bool isValid(const uint256&) const;
|
||||
|
||||
void setTrusted() { mTrusted = true; }
|
||||
std::vector<unsigned char> getSigned() const;
|
||||
std::vector<unsigned char> getSignature() const;
|
||||
Blob getSigned() const;
|
||||
Blob getSignature() const;
|
||||
void sign(uint256& signingHash, const RippleAddress& raPrivate);
|
||||
void sign(const RippleAddress& raPrivate);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Transaction::Transaction(SerializedTransaction::ref sit, bool bValidate)
|
||||
mStatus = NEW;
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedTransaction(const std::vector<unsigned char>&vucTransaction, bool bValidate)
|
||||
Transaction::pointer Transaction::sharedTransaction(Blob const& vucTransaction, bool bValidate)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
public:
|
||||
Transaction(SerializedTransaction::ref st, bool bValidate);
|
||||
|
||||
static Transaction::pointer sharedTransaction(const std::vector<unsigned char>&vucTransaction, bool bValidate);
|
||||
static Transaction::pointer sharedTransaction(Blob const& vucTransaction, bool bValidate);
|
||||
static Transaction::pointer transactionFromSQL(Database* db, bool bValidate);
|
||||
|
||||
Transaction(
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
STAmount getFee() const { return mTransaction->getTransactionFee(); }
|
||||
uint32 getFromAccountSeq() const { return mTransaction->getSequence(); }
|
||||
uint32 getSourceTag() const { return mTransaction->getFieldU32(sfSourceTag); }
|
||||
std::vector<unsigned char> getSignature() const { return mTransaction->getSignature(); }
|
||||
Blob getSignature() const { return mTransaction->getSignature(); }
|
||||
uint32 getLedger() const { return mInLedger; }
|
||||
TransStatus getStatus() const { return mStatus; }
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ void TransactionAcquire::trigger(Peer::ref peer)
|
||||
}
|
||||
|
||||
SMAddNode TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
|
||||
const std::list< std::vector<unsigned char> >& data, Peer::ref peer)
|
||||
const std::list< Blob >& data, Peer::ref peer)
|
||||
{
|
||||
if (mComplete)
|
||||
{
|
||||
@@ -149,7 +149,7 @@ SMAddNode TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
|
||||
if (nodeIDs.empty())
|
||||
return SMAddNode::invalid();
|
||||
std::list<SHAMapNode>::const_iterator nodeIDit = nodeIDs.begin();
|
||||
std::list< std::vector<unsigned char> >::const_iterator nodeDatait = data.begin();
|
||||
std::list< Blob >::const_iterator nodeDatait = data.begin();
|
||||
ConsensusTransSetSF sf;
|
||||
while (nodeIDit != nodeIDs.end())
|
||||
{
|
||||
@@ -188,7 +188,7 @@ SMAddNode TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
|
||||
}
|
||||
|
||||
void ConsensusTransSetSF::gotNode(bool fromFilter, const SHAMapNode& id, const uint256& nodeHash,
|
||||
const std::vector<unsigned char>& nodeData, SHAMapTreeNode::TNType type)
|
||||
Blob const& nodeData, SHAMapTreeNode::TNType type)
|
||||
{
|
||||
if (fromFilter)
|
||||
return;
|
||||
@@ -213,7 +213,7 @@ void ConsensusTransSetSF::gotNode(bool fromFilter, const SHAMapNode& id, const u
|
||||
}
|
||||
|
||||
bool ConsensusTransSetSF::haveNode(const SHAMapNode& id, const uint256& nodeHash,
|
||||
std::vector<unsigned char>& nodeData)
|
||||
Blob & nodeData)
|
||||
{
|
||||
if (theApp->getTempNodeCache().retrieve(nodeHash, nodeData))
|
||||
return true;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
SETUP_LOG (TransactionMetaSet)
|
||||
|
||||
TransactionMetaSet::TransactionMetaSet(const uint256& txid, uint32 ledger, const std::vector<unsigned char>& vec) :
|
||||
TransactionMetaSet::TransactionMetaSet(const uint256& txid, uint32 ledger, Blob const& vec) :
|
||||
mTransactionID(txid), mLedger(ledger), mNodes(sfAffectedNodes, 32)
|
||||
{
|
||||
Serializer s(vec);
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
TransactionMetaSet() : mLedger(0), mIndex(static_cast<uint32>(-1)), mResult(255) { ; }
|
||||
TransactionMetaSet(const uint256& txID, uint32 ledger, uint32 index) :
|
||||
mTransactionID(txID), mLedger(ledger), mIndex(static_cast<uint32>(-1)), mResult(255) { ; }
|
||||
TransactionMetaSet(const uint256& txID, uint32 ledger, const std::vector<unsigned char>&);
|
||||
TransactionMetaSet(const uint256& txID, uint32 ledger, Blob const&);
|
||||
|
||||
void init(const uint256& transactionID, uint32 ledger);
|
||||
void clear() { mNodes.clear(); }
|
||||
|
||||
@@ -45,7 +45,7 @@ static void addTxnSeqField()
|
||||
uint256 transID;
|
||||
SQL_FOREACH(db, "SELECT TransID,TxnMeta FROM Transactions;")
|
||||
{
|
||||
std::vector<unsigned char> rawMeta;
|
||||
Blob rawMeta;
|
||||
int metaSize = 2048;
|
||||
rawMeta.resize(metaSize);
|
||||
metaSize = db->getBinary("TxnMeta", &*rawMeta.begin(), rawMeta.size());
|
||||
|
||||
@@ -129,7 +129,7 @@ bool Wallet::dataFetch(const std::string& strKey, std::string& strValue)
|
||||
if (db->executeSQL(str(boost::format("SELECT Value FROM RPCData WHERE Key=%s;")
|
||||
% sqlEscape(strKey))) && db->startIterRows())
|
||||
{
|
||||
std::vector<unsigned char> vucData = db->getBinary("Value");
|
||||
Blob vucData = db->getBinary("Value");
|
||||
strValue.assign(vucData.begin(), vucData.end());
|
||||
|
||||
db->endIterRows();
|
||||
|
||||
@@ -4,8 +4,8 @@ TER WalletAddTransactor::doApply()
|
||||
{
|
||||
std::cerr << "WalletAdd>" << std::endl;
|
||||
|
||||
const std::vector<unsigned char> vucPubKey = mTxn.getFieldVL(sfPublicKey);
|
||||
const std::vector<unsigned char> vucSignature = mTxn.getFieldVL(sfSignature);
|
||||
Blob const vucPubKey = mTxn.getFieldVL(sfPublicKey);
|
||||
Blob const vucSignature = mTxn.getFieldVL(sfSignature);
|
||||
const uint160 uAuthKeyID = mTxn.getFieldAccount160(sfRegularKey);
|
||||
const RippleAddress naMasterPubKey = RippleAddress::createAccountPublic(vucPubKey);
|
||||
const uint160 uDstAccountID = naMasterPubKey.getAccountID();
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
*/
|
||||
HashedObject (HashedObjectType type,
|
||||
uint32 ledgerIndex,
|
||||
std::vector <unsigned char> const& binaryDataToCopy,
|
||||
Blob const& binaryDataToCopy,
|
||||
uint256 const& hash)
|
||||
: mType (type)
|
||||
, mHash (hash)
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
|
||||
/** Retrieve the binary data.
|
||||
*/
|
||||
std::vector <unsigned char> const& getData() const
|
||||
Blob const& getData() const
|
||||
{
|
||||
return mData;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
HashedObjectType const mType;
|
||||
uint256 const mHash;
|
||||
uint32 const mLedgerIndex;
|
||||
std::vector <unsigned char> const mData;
|
||||
Blob const mData;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -71,7 +71,7 @@ HashedObject::pointer HashedObjectStore::LLRetrieve(const uint256& hash, leveldb
|
||||
void HashedObjectStore::LLWrite(boost::shared_ptr<HashedObject> ptr, leveldb::DB* db)
|
||||
{
|
||||
HashedObject& obj = *ptr;
|
||||
std::vector<unsigned char> rawData(9 + obj.getData ().size());
|
||||
Blob rawData(9 + obj.getData ().size());
|
||||
unsigned char* bufPtr = &rawData.front();
|
||||
|
||||
*reinterpret_cast<uint32*>(bufPtr + 0) = ntohl(obj.getIndex ());
|
||||
@@ -97,7 +97,7 @@ void HashedObjectStore::LLWrite(const std::vector< boost::shared_ptr<HashedObjec
|
||||
BOOST_FOREACH(const boost::shared_ptr<HashedObject>& it, set)
|
||||
{
|
||||
const HashedObject& obj = *it;
|
||||
std::vector<unsigned char> rawData(9 + obj.getData ().size());
|
||||
Blob rawData(9 + obj.getData ().size());
|
||||
unsigned char* bufPtr = &rawData.front();
|
||||
|
||||
*reinterpret_cast<uint32*>(bufPtr + 0) = ntohl(obj.getIndex ());
|
||||
@@ -118,7 +118,7 @@ void HashedObjectStore::LLWrite(const std::vector< boost::shared_ptr<HashedObjec
|
||||
}
|
||||
|
||||
bool HashedObjectStore::storeLevelDB(HashedObjectType type, uint32 index,
|
||||
const std::vector<unsigned char>& data, const uint256& hash)
|
||||
Blob const& data, const uint256& hash)
|
||||
{ // return: false = already in cache, true = added to cache
|
||||
if (!theApp->getHashNodeLDB())
|
||||
return true;
|
||||
@@ -214,7 +214,7 @@ HashedObject::pointer HashedObjectStore::retrieveLevelDB(const uint256& hash)
|
||||
}
|
||||
|
||||
bool HashedObjectStore::storeSQLite(HashedObjectType type, uint32 index,
|
||||
const std::vector<unsigned char>& data, const uint256& hash)
|
||||
Blob const& data, const uint256& hash)
|
||||
{ // return: false = already in cache, true = added to cache
|
||||
if (!theApp->getHashNodeDB())
|
||||
{
|
||||
@@ -373,7 +373,7 @@ HashedObject::pointer HashedObjectStore::retrieveSQLite(const uint256& hash)
|
||||
if (!theApp || !theApp->getHashNodeDB())
|
||||
return obj;
|
||||
|
||||
std::vector<unsigned char> data;
|
||||
Blob data;
|
||||
std::string type;
|
||||
uint32 index;
|
||||
|
||||
@@ -479,7 +479,7 @@ int HashedObjectStore::import(const std::string& file)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<unsigned char> rawData;
|
||||
Blob rawData;
|
||||
int size = importDB->getBinary("Object", NULL, 0);
|
||||
rawData.resize(9 + size);
|
||||
unsigned char* bufPtr = &rawData.front();
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
return mCache.getHitRate();
|
||||
}
|
||||
|
||||
bool store (HashedObjectType type, uint32 index, const std::vector<unsigned char>& data,
|
||||
bool store (HashedObjectType type, uint32 index, Blob const& data,
|
||||
const uint256& hash)
|
||||
{
|
||||
if (mLevelDB)
|
||||
@@ -34,12 +34,12 @@ public:
|
||||
return retrieveSQLite(hash);
|
||||
}
|
||||
|
||||
bool storeSQLite(HashedObjectType type, uint32 index, const std::vector<unsigned char>& data,
|
||||
bool storeSQLite(HashedObjectType type, uint32 index, Blob const& data,
|
||||
const uint256& hash);
|
||||
HashedObject::pointer retrieveSQLite(const uint256& hash);
|
||||
void bulkWriteSQLite(Job&);
|
||||
|
||||
bool storeLevelDB(HashedObjectType type, uint32 index, const std::vector<unsigned char>& data,
|
||||
bool storeLevelDB(HashedObjectType type, uint32 index, Blob const& data,
|
||||
const uint256& hash);
|
||||
HashedObject::pointer retrieveLevelDB(const uint256& hash);
|
||||
void bulkWriteLevelDB(Job&);
|
||||
|
||||
@@ -1415,7 +1415,7 @@ void PeerImp::recvGetObjectByHash(const boost::shared_ptr<ripple::TMGetObjectByH
|
||||
uint256 hash;
|
||||
memcpy(hash.begin(), obj.hash().data(), 256 / 8);
|
||||
|
||||
boost::shared_ptr< std::vector<unsigned char> > data = boost::make_shared< std::vector<unsigned char> >
|
||||
boost::shared_ptr< Blob > data = boost::make_shared< Blob >
|
||||
(obj.data().begin(), obj.data().end());
|
||||
|
||||
theApp->getOPs().addFetchPack(hash, data);
|
||||
@@ -1771,7 +1771,7 @@ void PeerImp::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockH
|
||||
return;
|
||||
}
|
||||
std::vector<SHAMapNode> nodeIDs;
|
||||
std::list< std::vector<unsigned char> > rawNodes;
|
||||
std::list< Blob > rawNodes;
|
||||
try
|
||||
{
|
||||
if(map->getNodeFat(mn, nodeIDs, rawNodes, fatRoot, fatLeaves))
|
||||
@@ -1779,7 +1779,7 @@ void PeerImp::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockH
|
||||
assert(nodeIDs.size() == rawNodes.size());
|
||||
WriteLog (lsTRACE, Peer) << "getNodeFat got " << rawNodes.size() << " nodes";
|
||||
std::vector<SHAMapNode>::iterator nodeIDIterator;
|
||||
std::list< std::vector<unsigned char> >::iterator rawNodeIterator;
|
||||
std::list< Blob >::iterator rawNodeIterator;
|
||||
for(nodeIDIterator = nodeIDs.begin(), rawNodeIterator = rawNodes.begin();
|
||||
nodeIDIterator != nodeIDs.end(); ++nodeIDIterator, ++rawNodeIterator)
|
||||
{
|
||||
@@ -1854,7 +1854,7 @@ void PeerImp::recvLedger(const boost::shared_ptr<ripple::TMLedgerData>& packet_p
|
||||
if (packet.type() == ripple::liTS_CANDIDATE)
|
||||
{ // got data for a candidate transaction set
|
||||
std::list<SHAMapNode> nodeIDs;
|
||||
std::list< std::vector<unsigned char> > nodeData;
|
||||
std::list< Blob > nodeData;
|
||||
|
||||
for (int i = 0; i < packet.nodes().size(); ++i)
|
||||
{
|
||||
@@ -1866,7 +1866,7 @@ void PeerImp::recvLedger(const boost::shared_ptr<ripple::TMLedgerData>& packet_p
|
||||
return;
|
||||
}
|
||||
nodeIDs.push_back(SHAMapNode(node.nodeid().data(), node.nodeid().size()));
|
||||
nodeData.push_back(std::vector<unsigned char>(node.nodedata().begin(), node.nodedata().end()));
|
||||
nodeData.push_back(Blob (node.nodedata().begin(), node.nodedata().end()));
|
||||
}
|
||||
SMAddNode san = theApp->getOPs().gotTXData(shared_from_this(), hash, nodeIDs, nodeData);
|
||||
if (san.isInvalid())
|
||||
@@ -1952,7 +1952,7 @@ void PeerImp::getSessionCookie(std::string& strDst)
|
||||
void PeerImp::sendHello()
|
||||
{
|
||||
std::string strCookie;
|
||||
std::vector<unsigned char> vchSig;
|
||||
Blob vchSig;
|
||||
|
||||
getSessionCookie(strCookie);
|
||||
mCookieHash = Serializer::getSHA512Half(strCookie);
|
||||
|
||||
Reference in New Issue
Block a user