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


C++ BinaryDataRef::getSliceRef方法代码示例

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


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

示例1: unserialize

void TxIOPair::unserialize(const BinaryDataRef& val)
{
   BinaryRefReader brr(val);

   BitUnpacker<uint8_t> bitunpack(brr);
   isTxOutFromSelf_  = bitunpack.getBit();
   isFromCoinbase_   = bitunpack.getBit();
   bool isSpent      = bitunpack.getBit();
   isMultisig_       = bitunpack.getBit();
   isUTXO_           = bitunpack.getBit();
   isFromSameBlock_     = bitunpack.getBit();

   // We always include the 8-byte value
   amount_ = brr.get_uint64_t();

   setTxOut(val.getSliceRef(9, 8));
   if (val.getSize() == 25)
      setTxIn(val.getSliceRef(17, 8));

   //the key always carries the full txout ref
   /*if (!isSpent)
      setTxOut(key);
   else
   {
      //spent subssh, txout key      
      setTxOut(val.getSliceRef(9, 8));

      //when keyed by txins, the top bit in the tx index is always flipped
      BinaryData txinKey(key);
      txinKey.getPtr()[4] &= 0x7F;
      
      //last 8 bytes carry the txin key
      setTxIn(txinKey);
   }*/
}
开发者ID:Groestlcoin,项目名称:GroestlcoinArmory,代码行数:35,代码来源:txio.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


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