本文整理了Java中org.bitcoinj.core.Transaction.setHash()
方法的一些代码示例,展示了Transaction.setHash()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.setHash()
方法的具体详情如下:
包路径:org.bitcoinj.core.Transaction
类名称:Transaction
方法名:setHash
[英]Used by BitcoinSerializer. The serializer has to calculate a hash for checksumming so to avoid wasting the considerable effort a set method is provided so the serializer can set it. No verification is performed on this hash.
[中]由比特币序列化程序使用。序列化程序必须计算校验和的哈希值,以避免浪费大量的精力,因此提供了一个set方法,以便序列化程序可以对其进行设置。未对此哈希执行任何验证。
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/**
* Make a transaction from the payload. Extension point for alternative
* serialization format support.
*/
@Override
public Transaction makeTransaction(byte[] payloadBytes, int offset,
int length, byte[] hash) throws ProtocolException {
Transaction tx = new Transaction(params, payloadBytes, offset, null, this, length);
if (hash != null)
tx.setHash(Sha256Hash.wrapReversed(hash));
return tx;
}
代码示例来源:origin: greenaddress/GreenBits
/**
* Make a transaction from the payload. Extension point for alternative
* serialization format support.
*/
@Override
public Transaction makeTransaction(byte[] payloadBytes, int offset,
int length, byte[] hash) throws ProtocolException {
Transaction tx = new Transaction(params, payloadBytes, offset, null, this, length);
if (hash != null)
tx.setHash(Sha256Hash.wrapReversed(hash));
return tx;
}
代码示例来源:origin: HashEngineering/dashj
/**
* Make a transaction from the payload. Extension point for alternative
* serialization format support.
*/
@Override
public Transaction makeTransaction(byte[] payloadBytes, int offset,
int length, byte[] hash) throws ProtocolException {
Transaction tx = new Transaction(params, payloadBytes, offset, null, this, length);
if (hash != null)
tx.setHash(Sha256Hash.wrapReversed(hash));
return tx;
}
代码示例来源:origin: fr.acinq/bitcoinj-core
/**
* Make a transaction from the payload. Extension point for alternative
* serialization format support.
*/
@Override
public Transaction makeTransaction(byte[] payloadBytes, int offset, int length, byte[] payloadHash)
throws ProtocolException {
Transaction tx = new Transaction(params, payloadBytes, offset, null, this, length);
if (payloadHash != null && !tx.hasWitness())
// We can only use this optimization if payloadHash equals the transaction hash (aka txid). This is not the
// case for transactions with witnesses. In this case, the transaction hash will be computed later.
tx.setHash(Sha256Hash.wrapReversed(payloadHash));
return tx;
}
内容来源于网络,如有侵权,请联系作者删除!