Mercurial > hg > Database > Christie
comparison src/main/java/christie/blockchain/BlockHeader.java @ 146:0ef25958ac04
add transaction
author | akahori |
---|---|
date | Mon, 07 Jan 2019 16:02:26 +0900 |
parents | 694ea96a557a |
children | cd2fab84cd8b |
comparison
equal
deleted
inserted
replaced
140:77169cd8a5e8 | 146:0ef25958ac04 |
---|---|
28 this.difficulty = difficulty; | 28 this.difficulty = difficulty; |
29 this.number = number; | 29 this.number = number; |
30 this.timestamp = timestamp; | 30 this.timestamp = timestamp; |
31 } | 31 } |
32 | 32 |
33 public byte[] getHash(boolean withNonce){ | 33 public byte[] getParamByteArray(boolean withNonce){ |
34 | 34 |
35 ByteArrayOutputStream output = new ByteArrayOutputStream(); | 35 ByteArrayOutputStream output = new ByteArrayOutputStream(); |
36 | 36 |
37 byte[] timestampByte = BigInteger.valueOf(this.timestamp).toByteArray(); | 37 byte[] timestampByte = BigInteger.valueOf(this.timestamp).toByteArray(); |
38 | 38 |
55 return output.toByteArray(); | 55 return output.toByteArray(); |
56 | 56 |
57 } | 57 } |
58 | 58 |
59 public byte[] getParentHash() { | 59 public byte[] getParentHash() { |
60 | |
60 return parentHash; | 61 return parentHash; |
61 } | 62 } |
62 | 63 |
63 public byte[] getPresentHash() { | 64 public byte[] getPresentHash() { |
64 return hashUtil.sha256(getHash(true)); | 65 |
66 return hashUtil.sha256(getParamByteArray(true)); | |
65 } | 67 } |
66 | 68 |
67 public byte[] getPresentHashWithoutNonce(){ | 69 public byte[] getByteArrayWithoutNonce(){ |
68 return getHash(false); | 70 |
71 return getParamByteArray(false); | |
69 } | 72 } |
70 | 73 |
71 public void setTimestamp(long timestamp) { | 74 public void setTimestamp(long timestamp) { |
72 this.timestamp = timestamp; | 75 this.timestamp = timestamp; |
73 } | 76 } |