本文整理了Java中org.bitcoinj.core.Block.hasTransactions()
方法的一些代码示例,展示了Block.hasTransactions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.hasTransactions()
方法的具体详情如下:
包路径:org.bitcoinj.core.Block
类名称:Block
方法名:hasTransactions
[英]Return whether this block contains any transactions.
[中]返回此块是否包含任何事务。
代码示例来源:origin: fr.acinq/bitcoinj-core
@Override
protected void parse() throws ProtocolException {
long numHeaders = readVarInt();
if (numHeaders > MAX_HEADERS)
throw new ProtocolException("Too many headers: got " + numHeaders + " which is larger than " +
MAX_HEADERS);
blockHeaders = new ArrayList<>();
final BitcoinSerializer serializer = this.params.getSerializer(true);
for (int i = 0; i < numHeaders; ++i) {
final Block newBlockHeader = serializer.makeBlock(payload, cursor, UNKNOWN_LENGTH);
if (newBlockHeader.hasTransactions()) {
throw new ProtocolException("Block header does not end with a null byte");
}
cursor += newBlockHeader.optimalEncodingMessageSize;
blockHeaders.add(newBlockHeader);
}
if (length == UNKNOWN_LENGTH) {
length = cursor - offset;
}
if (log.isDebugEnabled()) {
for (int i = 0; i < numHeaders; ++i) {
log.debug(this.blockHeaders.get(i).toString());
}
}
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
@Override
protected void parse() throws ProtocolException {
long numHeaders = readVarInt();
if (numHeaders > MAX_HEADERS)
throw new ProtocolException("Too many headers: got " + numHeaders + " which is larger than " +
MAX_HEADERS);
blockHeaders = new ArrayList<Block>();
final BitcoinSerializer serializer = this.params.getSerializer(true);
for (int i = 0; i < numHeaders; ++i) {
final Block newBlockHeader = serializer.makeBlock(payload, cursor, UNKNOWN_LENGTH);
if (newBlockHeader.hasTransactions()) {
throw new ProtocolException("Block header does not end with a null byte");
}
cursor += newBlockHeader.optimalEncodingMessageSize;
blockHeaders.add(newBlockHeader);
}
if (length == UNKNOWN_LENGTH) {
length = cursor - offset;
}
if (log.isDebugEnabled()) {
for (int i = 0; i < numHeaders; ++i) {
log.debug(this.blockHeaders.get(i).toString());
}
}
}
代码示例来源:origin: greenaddress/GreenBits
@Override
protected void parse() throws ProtocolException {
long numHeaders = readVarInt();
if (numHeaders > MAX_HEADERS)
throw new ProtocolException("Too many headers: got " + numHeaders + " which is larger than " +
MAX_HEADERS);
blockHeaders = new ArrayList<>();
final BitcoinSerializer serializer = this.params.getSerializer(true);
for (int i = 0; i < numHeaders; ++i) {
final Block newBlockHeader = serializer.makeBlock(payload, cursor, UNKNOWN_LENGTH);
if (newBlockHeader.hasTransactions()) {
throw new ProtocolException("Block header does not end with a null byte");
}
cursor += newBlockHeader.optimalEncodingMessageSize;
blockHeaders.add(newBlockHeader);
}
if (length == UNKNOWN_LENGTH) {
length = cursor - offset;
}
if (log.isDebugEnabled()) {
for (int i = 0; i < numHeaders; ++i) {
log.debug(this.blockHeaders.get(i).toString());
}
}
}
代码示例来源:origin: HashEngineering/dashj
@Override
protected void parse() throws ProtocolException {
long numHeaders = readVarInt();
if (numHeaders > MAX_HEADERS)
throw new ProtocolException("Too many headers: got " + numHeaders + " which is larger than " +
MAX_HEADERS);
blockHeaders = new ArrayList<Block>();
final BitcoinSerializer serializer = this.params.getSerializer(true);
for (int i = 0; i < numHeaders; ++i) {
final Block newBlockHeader = serializer.makeBlock(payload, cursor, UNKNOWN_LENGTH);
if (newBlockHeader.hasTransactions()) {
throw new ProtocolException("Block header does not end with a null byte");
}
cursor += newBlockHeader.optimalEncodingMessageSize;
blockHeaders.add(newBlockHeader);
}
if (length == UNKNOWN_LENGTH) {
length = cursor - offset;
}
if (log.isDebugEnabled()) {
for (int i = 0; i < numHeaders; ++i) {
log.debug(this.blockHeaders.get(i).toString());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!