mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 02:35:52 +00:00
Expand Block.toString() to use StringBuilder.
This commit is contained in:
parent
a0d2b36c9f
commit
5ec4f43dee
@ -534,10 +534,26 @@ public class Block extends Message {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer s = new StringBuffer("v" + version + " block: \n" + " previous block: "
|
StringBuilder s = new StringBuilder("v");
|
||||||
+ getPrevBlockHash().toString() + "\n" + " merkle root: " + getMerkleRoot().toString() + "\n"
|
s.append(version);
|
||||||
+ " time: [" + time + "] " + new Date(time * 1000).toString() + "\n"
|
s.append(" block: \n");
|
||||||
+ " difficulty target (nBits): " + difficultyTarget + "\n" + " nonce: " + nonce + "\n");
|
s.append(" previous block: ");
|
||||||
|
s.append(getPrevBlockHash());
|
||||||
|
s.append("\n");
|
||||||
|
s.append(" merkle root: ");
|
||||||
|
s.append(getMerkleRoot());
|
||||||
|
s.append("\n");
|
||||||
|
s.append(" time: [");
|
||||||
|
s.append(time);
|
||||||
|
s.append("] ");
|
||||||
|
s.append(new Date(time * 1000));
|
||||||
|
s.append("\n");
|
||||||
|
s.append(" difficulty target (nBits): ");
|
||||||
|
s.append(difficultyTarget);
|
||||||
|
s.append("\n");
|
||||||
|
s.append(" nonce: ");
|
||||||
|
s.append(nonce);
|
||||||
|
s.append("\n");
|
||||||
if (transactions != null && transactions.size() > 0) {
|
if (transactions != null && transactions.size() > 0) {
|
||||||
s.append(" with ").append(transactions.size()).append(" transaction(s):\n");
|
s.append(" with ").append(transactions.size()).append(" transaction(s):\n");
|
||||||
for (Transaction tx : transactions) {
|
for (Transaction tx : transactions) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user