本文整理汇总了C++中Tx::getTxInOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ Tx::getTxInOffset方法的具体用法?C++ Tx::getTxInOffset怎么用?C++ Tx::getTxInOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tx
的用法示例。
在下文中一共展示了Tx::getTxInOffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outPointRef
map<BinaryData, map<BinaryData, TxIOPair> >
ZeroConfContainer::ZCisMineBulkFilter(const Tx & tx,
const BinaryData & ZCkey, uint32_t txtime,
function<bool(const BinaryData&)> filter,
bool withSecondOrderMultisig)
{
// Since 99.999%+ of all transactions are not ours, let's do the
// fastest bulk filter possible, even though it will add
// redundant computation to the tx that are ours. In fact,
// we will skip the TxIn/TxOut convenience methods and follow the
// pointers directly to the data we want
/***filter is a pointer to a function that takes in a scrAddr (21 bytes,
including the prefix) and returns a bool. For supernode, it should return
true all the time.
***/
map<BinaryData, map<BinaryData, TxIOPair> > processedTxIO;
BinaryData txHash = tx.getThisHash();
TxRef txref = db_->getTxRef(txHash);
if (txref.isInitialized())
{
//Found this tx in the db. It is already part of a block thus
//is invalid as a ZC
return processedTxIO;
}
uint8_t const * txStartPtr = tx.getPtr();
for (uint32_t iin = 0; iin<tx.getNumTxIn(); iin++)
{
// We have the txin, now check if it contains one of our TxOuts
OutPoint op;
op.unserialize(txStartPtr + tx.getTxInOffset(iin), 36);
//check ZC txhash first, always cheaper than grabing a stxo from DB,
//and will always be checked if the tx doesn't hit in DB outpoints.
{
BinaryData opZcKey;
if (getKeyForTxHash(op.getTxHash(), opZcKey))
{
TxRef outPointRef(opZcKey);
uint16_t outPointId = op.getTxOutIndex();
TxIOPair txio(outPointRef, outPointId,
TxRef(ZCkey), iin);
Tx chainedZC = getTxByHash(op.getTxHash());
const TxOut& chainedTxOut = chainedZC.getTxOutCopy(outPointId);
txio.setTxHashOfOutput(op.getTxHash());
txio.setTxHashOfInput(txHash);
txio.setValue(chainedTxOut.getValue());
txio.setTxTime(txtime);
BinaryData spentSA = chainedTxOut.getScrAddressStr();
auto& key_txioPair = processedTxIO[spentSA];
key_txioPair[txio.getDBKeyOfOutput()] = txio;
auto& wltIdVec = keyToSpentScrAddr_[ZCkey];
wltIdVec.push_back(spentSA);
txOutsSpentByZC_.insert(txio.getDBKeyOfOutput());
continue;
}
}
//fetch the TxOut from DB
BinaryData opKey = op.getDBkey(db_);
if (opKey.getSize() == 8)
{
//found outPoint DBKey, grab the StoredTxOut
StoredTxOut stxOut;
if (db_->getStoredTxOut(stxOut, opKey))
{
BinaryData sa = stxOut.getScrAddress();
if (filter(sa))
{
TxIOPair txio(TxRef(opKey.getSliceRef(0, 6)), op.getTxOutIndex(),
TxRef(ZCkey), iin);
txio.setTxHashOfOutput(op.getTxHash());
txio.setTxHashOfInput(txHash);
txio.setValue(stxOut.getValue());
txio.setTxTime(txtime);
auto& key_txioPair = processedTxIO[sa];
key_txioPair[opKey] = txio;
auto& wltIdVec = keyToSpentScrAddr_[ZCkey];
wltIdVec.push_back(sa);
txOutsSpentByZC_.insert(opKey);
}
}
}
}
//.........这里部分代码省略.........