本文整理汇总了C++中BinaryWriter::put_BinaryDataRef方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryWriter::put_BinaryDataRef方法的具体用法?C++ BinaryWriter::put_BinaryDataRef怎么用?C++ BinaryWriter::put_BinaryDataRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter::put_BinaryDataRef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDataForSigHashAll
BinaryData SigHashDataSegWit::getDataForSigHashAll(const TransactionStub& stub,
BinaryDataRef subScript, unsigned inputIndex)
{
//grab subscript
auto lastCSoffset = stub.getLastCodeSeparatorOffset(inputIndex);
auto subScriptLen = subScript.getSize() - lastCSoffset;
auto&& subscript = subScript.getSliceRef(lastCSoffset, subScriptLen);
//pre state
computePreState(stub);
//serialize hashdata
BinaryWriter hashdata;
//version
hashdata.put_uint32_t(stub.getVersion());
//hashPrevouts
hashdata.put_BinaryData(hashPrevouts_);
//hashSequence
hashdata.put_BinaryData(hashSequence_);
//outpoint
hashdata.put_BinaryDataRef(stub.getOutpoint(inputIndex));
//script code
hashdata.put_uint8_t(subScriptLen);
hashdata.put_BinaryDataRef(subscript);
//value
hashdata.put_uint64_t(stub.getOutpointValue(inputIndex));
//sequence
hashdata.put_uint32_t(stub.getTxInSequence(inputIndex));
//hashOutputs
hashdata.put_BinaryData(hashOutputs_);
//nLocktime
hashdata.put_uint32_t(stub.getLockTime());
//sighash type
hashdata.put_uint32_t(1);
return hashdata.getData();
}
示例2: serializeAllOutpoints
BinaryData TransactionVerifier::serializeAllOutpoints() const
{
BinaryWriter bw;
for (unsigned i = 0; i < theTx_.txins_.size(); i++)
bw.put_BinaryDataRef(getOutpoint(i));
return bw.getData();
}
示例3: serializeAllSequences
BinaryData TransactionVerifier::serializeAllSequences() const
{
BinaryWriter bw;
for (auto& txinOnS : theTx_.txins_)
{
auto sequenceOffset = txinOnS.first + txinOnS.second - 4;
BinaryDataRef bdr(theTx_.data_ + sequenceOffset, 4);
bw.put_BinaryDataRef(bdr);
}
return bw.getData();
}