本文整理了Java中org.bitcoinj.core.Block.toString()
方法的一些代码示例,展示了Block.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.toString()
方法的具体详情如下:
包路径:org.bitcoinj.core.Block
类名称:Block
方法名:toString
[英]Returns a multi-line string containing a description of the contents of the block. Use for debugging purposes only.
[中]返回包含块内容描述的多行字符串。仅用于调试目的。
代码示例来源:origin: stackoverflow.com
{ return connector.toString(); }
代码示例来源:origin: fr.acinq/bitcoinj-core
/**
* Processes a received block and tries to add it to the chain. If there's something wrong with the block an
* exception is thrown. If the block is OK but cannot be connected to the chain at this time, returns false.
* If the block can be connected to the chain, returns true.
* Accessing block's transactions in another thread while this method runs may result in undefined behavior.
*/
public boolean add(Block block) throws VerificationException, PrunedException {
try {
return add(block, true, null, null);
} catch (BlockStoreException e) {
// TODO: Figure out a better way to propagate this exception to the user.
throw new RuntimeException(e);
} catch (VerificationException e) {
try {
notSettingChainHead();
} catch (BlockStoreException e1) {
throw new RuntimeException(e1);
}
throw new VerificationException("Could not verify block:\n" +
block.toString(), e);
}
}
代码示例来源:origin: greenaddress/GreenBits
/**
* Processes a received block and tries to add it to the chain. If there's something wrong with the block an
* exception is thrown. If the block is OK but cannot be connected to the chain at this time, returns false.
* If the block can be connected to the chain, returns true.
* Accessing block's transactions in another thread while this method runs may result in undefined behavior.
*/
public boolean add(Block block) throws VerificationException, PrunedException {
try {
return add(block, true, null, null);
} catch (BlockStoreException e) {
// TODO: Figure out a better way to propagate this exception to the user.
throw new RuntimeException(e);
} catch (VerificationException e) {
try {
notSettingChainHead();
} catch (BlockStoreException e1) {
throw new RuntimeException(e1);
}
throw new VerificationException("Could not verify block:\n" +
block.toString(), e);
}
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/**
* Processes a received block and tries to add it to the chain. If there's something wrong with the block an
* exception is thrown. If the block is OK but cannot be connected to the chain at this time, returns false.
* If the block can be connected to the chain, returns true.
* Accessing block's transactions in another thread while this method runs may result in undefined behavior.
*/
public boolean add(Block block) throws VerificationException, PrunedException {
try {
return add(block, true, null, null);
} catch (BlockStoreException e) {
// TODO: Figure out a better way to propagate this exception to the user.
throw new RuntimeException(e);
} catch (VerificationException e) {
try {
notSettingChainHead();
} catch (BlockStoreException e1) {
throw new RuntimeException(e1);
}
throw new VerificationException("Could not verify block:\n" +
block.toString(), e);
}
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
@Override
public String toString() {
return String.format(Locale.US, "Block %s at height %d: %s",
getHeader().getHashAsString(), getHeight(), getHeader().toString());
}
}
代码示例来源:origin: fr.acinq/bitcoinj-core
@Override
public String toString() {
return String.format(Locale.US, "Block %s at height %d: %s",
getHeader().getHashAsString(), getHeight(), getHeader().toString());
}
}
代码示例来源:origin: HashEngineering/dashj
/**
* Processes a received block and tries to add it to the chain. If there's something wrong with the block an
* exception is thrown. If the block is OK but cannot be connected to the chain at this time, returns false.
* If the block can be connected to the chain, returns true.
* Accessing block's transactions in another thread while this method runs may result in undefined behavior.
*/
public boolean add(Block block) throws VerificationException, PrunedException {
try {
return add(block, true, null, null);
} catch (BlockStoreException e) {
// TODO: Figure out a better way to propagate this exception to the user.
throw new RuntimeException(e);
} catch (VerificationException e) {
try {
notSettingChainHead();
} catch (BlockStoreException e1) {
throw new RuntimeException(e1);
}
throw new VerificationException("Could not verify block:\n" +
block.toString(), e);
}
}
代码示例来源:origin: greenaddress/GreenBits
@Override
public String toString() {
return String.format(Locale.US, "Block %s at height %d: %s",
getHeader().getHashAsString(), getHeight(), getHeader().toString());
}
}
代码示例来源:origin: HashEngineering/dashj
@Override
public String toString() {
return String.format(Locale.US, "Block %s at height %d: %s",
getHeader().getHashAsString(), getHeight(), getHeader().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());
}
}
}
代码示例来源: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());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!