mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 21:15:58 +00:00
Fix a bug in TransactionMaster::fetch. Also, don't use this anyway.
This commit is contained in:
@@ -1029,18 +1029,17 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted)
|
|||||||
|
|
||||||
for (SHAMapItem::pointer item = txSet.peekFirstItem(); !!item; item = txSet.peekNextItem(item->getTag()))
|
for (SHAMapItem::pointer item = txSet.peekFirstItem(); !!item; item = txSet.peekNextItem(item->getTag()))
|
||||||
{
|
{
|
||||||
SerializedTransaction::pointer stTxn = theApp->getMasterTransaction().fetch(item, false, 0);
|
|
||||||
if(stTxn)
|
|
||||||
{
|
|
||||||
// XXX Need to support other results.
|
|
||||||
// XXX Need to give failures too.
|
|
||||||
TER terResult = tesSUCCESS;
|
|
||||||
|
|
||||||
SerializerIterator it(item->peekSerializer());
|
SerializerIterator it(item->peekSerializer());
|
||||||
|
|
||||||
TransactionMetaSet::pointer meta = boost::make_shared<TransactionMetaSet>(stTxn->getTransactionID(), lpAccepted->getLedgerSeq(), it.getVL());
|
// OPTIMIZEME: Could get transaction from txn master, but still must call getVL
|
||||||
pubAcceptedTransaction(lpAccepted, *stTxn, terResult,meta);
|
Serializer txnSer(it.getVL());
|
||||||
}
|
SerializerIterator txnIt(txnSer);
|
||||||
|
SerializedTransaction stTxn(txnIt);
|
||||||
|
|
||||||
|
TransactionMetaSet::pointer meta = boost::make_shared<TransactionMetaSet>(
|
||||||
|
stTxn.getTransactionID(), lpAccepted->getLedgerSeq(), it.getVL());
|
||||||
|
|
||||||
|
pubAcceptedTransaction(lpAccepted, stTxn, meta->getResultTER(), meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ public:
|
|||||||
// totality functions
|
// totality functions
|
||||||
const std::vector<unsigned char>& peekData() const { return mData; }
|
const std::vector<unsigned char>& peekData() const { return mData; }
|
||||||
std::vector<unsigned char> getData() const { return mData; }
|
std::vector<unsigned char> getData() const { return mData; }
|
||||||
|
std::vector<unsigned char>& modData() { return mData; }
|
||||||
int getCapacity() const { return mData.capacity(); }
|
int getCapacity() const { return mData.capacity(); }
|
||||||
int getDataLength() const { return mData.size(); }
|
int getDataLength() const { return mData.size(); }
|
||||||
const void* getDataPtr() const { return &mData.front(); }
|
const void* getDataPtr() const { return &mData.front(); }
|
||||||
|
|||||||
@@ -31,17 +31,30 @@ Transaction::pointer TransactionMaster::fetch(const uint256& txnID, bool checkDi
|
|||||||
return txn;
|
return txn;
|
||||||
}
|
}
|
||||||
|
|
||||||
SerializedTransaction::pointer TransactionMaster::fetch(SHAMapItem::ref item, bool checkDisk, uint32 uCommitLedger)
|
SerializedTransaction::pointer TransactionMaster::fetch(SHAMapItem::ref item, SHAMapTreeNode::TNType type,
|
||||||
|
bool checkDisk, uint32 uCommitLedger)
|
||||||
{
|
{
|
||||||
SerializedTransaction::pointer txn;
|
SerializedTransaction::pointer txn;
|
||||||
Transaction::pointer iTx = theApp->getMasterTransaction().fetch(item->getTag(), false);
|
Transaction::pointer iTx = theApp->getMasterTransaction().fetch(item->getTag(), false);
|
||||||
|
|
||||||
if (!iTx)
|
if (!iTx)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||||
{
|
{
|
||||||
SerializerIterator sit(item->peekSerializer());
|
SerializerIterator sit(item->peekSerializer());
|
||||||
|
txn = boost::make_shared<SerializedTransaction>(boost::ref(sit));
|
||||||
|
}
|
||||||
|
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||||
|
{
|
||||||
|
Serializer s;
|
||||||
|
int length;
|
||||||
|
item->peekSerializer().getVL(s.modData(), 0, length);
|
||||||
|
SerializerIterator sit(s);
|
||||||
|
|
||||||
txn = boost::make_shared<SerializedTransaction>(boost::ref(sit));
|
txn = boost::make_shared<SerializedTransaction>(boost::ref(sit));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (uCommitLedger)
|
if (uCommitLedger)
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ public:
|
|||||||
TransactionMaster();
|
TransactionMaster();
|
||||||
|
|
||||||
Transaction::pointer fetch(const uint256&, bool checkDisk);
|
Transaction::pointer fetch(const uint256&, bool checkDisk);
|
||||||
SerializedTransaction::pointer fetch(SHAMapItem::ref item, bool checkDisk, uint32 uCommitLedger);
|
SerializedTransaction::pointer fetch(SHAMapItem::ref item, SHAMapTreeNode:: TNType type,
|
||||||
|
bool checkDisk, uint32 uCommitLedger);
|
||||||
|
|
||||||
// return value: true = we had the transaction already
|
// return value: true = we had the transaction already
|
||||||
bool canonicalize(Transaction::pointer& txn, bool maybeNew);
|
bool canonicalize(Transaction::pointer& txn, bool maybeNew);
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ public:
|
|||||||
|
|
||||||
const uint256& getTxID() { return mTransactionID; }
|
const uint256& getTxID() { return mTransactionID; }
|
||||||
uint32 getLgrSeq() { return mLedger; }
|
uint32 getLgrSeq() { return mLedger; }
|
||||||
|
int getResult() const { return mResult; }
|
||||||
|
TER getResultTER() const { return static_cast<TER>(mResult); }
|
||||||
|
|
||||||
bool isNodeAffected(const uint256&) const;
|
bool isNodeAffected(const uint256&) const;
|
||||||
void setAffectedNode(const uint256&, SField::ref type, uint16 nodeType);
|
void setAffectedNode(const uint256&, SField::ref type, uint16 nodeType);
|
||||||
@@ -45,6 +47,7 @@ public:
|
|||||||
const STObject& peekAffectedNode(const uint256&) const;
|
const STObject& peekAffectedNode(const uint256&) const;
|
||||||
//std::vector<RippleAddress> getAffectedAccounts();
|
//std::vector<RippleAddress> getAffectedAccounts();
|
||||||
|
|
||||||
|
|
||||||
Json::Value getJson(int p) const { return getAsObject().getJson(p); }
|
Json::Value getJson(int p) const { return getAsObject().getJson(p); }
|
||||||
void addRaw(Serializer&, TER);
|
void addRaw(Serializer&, TER);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user