本文整理汇总了C++中StellarMessage::transaction方法的典型用法代码示例。如果您正苦于以下问题:C++ StellarMessage::transaction方法的具体用法?C++ StellarMessage::transaction怎么用?C++ StellarMessage::transaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StellarMessage
的用法示例。
在下文中一共展示了StellarMessage::transaction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Peer::recvTransaction(StellarMessage const& msg)
{
TransactionFramePtr transaction = TransactionFrame::makeTransactionFromWire(
mApp.getNetworkID(), msg.transaction());
if (transaction)
{
// add it to our current set
// and make sure it is valid
auto recvRes = mApp.getHerder().recvTransaction(transaction);
if (recvRes == Herder::TX_STATUS_PENDING ||
recvRes == Herder::TX_STATUS_DUPLICATE)
{
// record that this peer sent us this transaction
mApp.getOverlayManager().recvFloodedMsg(msg, shared_from_this());
if (recvRes == Herder::TX_STATUS_PENDING)
{
// if it's a new transaction, broadcast it
mApp.getOverlayManager().broadcastMessage(msg);
}
}
}
}
示例2:
StellarMessage
TransactionFrame::toStellarMessage() const
{
StellarMessage msg;
msg.type(TRANSACTION);
msg.transaction() = mEnvelope;
return msg;
}
示例3: txm
Herder::TransactionSubmitStatus
LoadGenerator::TxInfo::execute(Application& app, bool isCreate,
TransactionResultCode& code, int32_t batchSize)
{
auto seqNum = mFrom->getLastSequenceNumber();
mFrom->setSequenceNumber(seqNum + 1);
TransactionFramePtr txf =
transactionFromOperations(app, mFrom->getSecretKey(), seqNum + 1, mOps);
TxMetrics txm(app.getMetrics());
// Record tx metrics.
if (isCreate)
{
while (batchSize--)
{
txm.mAccountCreated.Mark();
}
}
else
{
txm.mPayment.Mark();
txm.mNativePayment.Mark();
}
txm.mTxnAttempted.Mark();
StellarMessage msg;
msg.type(TRANSACTION);
msg.transaction() = txf->getEnvelope();
txm.mTxnBytes.Mark(xdr::xdr_argpack_size(msg));
auto status = app.getHerder().recvTransaction(txf);
if (status != Herder::TX_STATUS_PENDING)
{
CLOG(INFO, "LoadGen")
<< "tx rejected '" << Herder::TX_STATUS_STRING[status]
<< "': " << xdr::xdr_to_string(txf->getEnvelope()) << " ===> "
<< xdr::xdr_to_string(txf->getResult());
if (status == Herder::TX_STATUS_ERROR)
{
code = txf->getResultCode();
}
txm.mTxnRejected.Mark();
}
else
{
app.getOverlayManager().broadcastMessage(msg);
}
return status;
}
示例4:
void
Peer::recvTransaction(StellarMessage const& msg)
{
TransactionFramePtr transaction =
TransactionFrame::makeTransactionFromWire(msg.transaction());
if (transaction)
{
// add it to our current set
// and make sure it is valid
if (mApp.getHerder().recvTransaction(transaction))
{
mApp.getOverlayManager().recvFloodedMsg(msg, shared_from_this());
mApp.getOverlayManager().broadcastMessage(msg);
}
}
}