当前位置: 首页>>代码示例>>C++>>正文


C++ BinaryWriter::put_uint32_t方法代码示例

本文整理汇总了C++中BinaryWriter::put_uint32_t方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryWriter::put_uint32_t方法的具体用法?C++ BinaryWriter::put_uint32_t怎么用?C++ BinaryWriter::put_uint32_t使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BinaryWriter的用法示例。


在下文中一共展示了BinaryWriter::put_uint32_t方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: serialize

void LedgerEntryVector::serialize(BinaryWriter& bw) const
{
   bw.put_uint8_t(LEDGERENTRYVECTOR_CODE);
   bw.put_var_int(leVec_.size());

   for (auto& le : leVec_)
   {
      auto idSize = le.ID_.size();
      size_t totalsize = idSize + 53;
      bw.put_var_int(totalsize);

      bw.put_var_int(idSize);
      bw.put_BinaryData((uint8_t*)le.ID_.c_str(), idSize);
      
      bw.put_uint64_t(le.value_);
      bw.put_uint32_t(le.blockNum_);
      bw.put_BinaryData(le.txHash_);
      bw.put_uint32_t(le.index_);
      bw.put_uint32_t(le.txTime_);

      BitPacker<uint8_t> bp;
      bp.putBit(le.isCoinbase_);
      bp.putBit(le.isSentToSelf_);
      bp.putBit(le.isChangeBack_);
      bp.putBit(le.optInRBF_);

      bw.put_BitPacker(bp);
   }
}
开发者ID:achow101,项目名称:BitcoinArmory,代码行数:29,代码来源:DataObject.cpp

示例2: 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();
}
开发者ID:yurivict,项目名称:BitcoinArmory,代码行数:47,代码来源:Transactions.cpp

示例3: serialize

BinaryData StackItem_OpCode::serialize(void) const
{
   BinaryWriter bw;
   bw.put_uint32_t(id_);
   bw.put_uint8_t(STACKITEM_OPCODE_PREFIX);
   bw.put_uint8_t(opcode_);

   return bw.getData();
}
开发者ID:Rudd-O,项目名称:BitcoinArmory,代码行数:9,代码来源:Script.cpp

示例4: serializeWholeBlock

BinaryData BlockHeaderRef::serializeWholeBlock(bool withLead8Bytes) const
{
   BinaryWriter serializedBlock;
   uint32_t blksize = getBlockSize();
   if(withLead8Bytes)
   {
      serializedBlock.reserve(blksize + 8);
      serializedBlock.put_BinaryData(BtcUtils::MagicBytes_);
      serializedBlock.put_uint32_t(blksize);
   }
   else
      serializedBlock.reserve(blksize);

   serializedBlock.put_BinaryData(self_);
   serializedBlock.put_var_int(getNumTx());
   for(uint32_t i=0; i<getNumTx(); i++)
      serializedBlock.put_BinaryData(txPtrList_[i]->serialize());

   return serializedBlock.getData();
   
}
开发者ID:Ajaydhyani,项目名称:PyBtcEngine,代码行数:21,代码来源:BlockObjRef.cpp

示例5: serialize

void OutPoint::serialize(BinaryWriter & bw) const
{
   bw.put_BinaryData(txHash_);
   bw.put_uint32_t(txOutIndex_);
}
开发者ID:R0B3RDV,项目名称:BitcoinArmory,代码行数:5,代码来源:BlockObj.cpp


注:本文中的BinaryWriter::put_uint32_t方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。