diff src/main/java/christie/blockchain/BlockHeader.java @ 139:694ea96a557a

refactor blockchain
author akahori
date Tue, 01 Jan 2019 15:07:22 +0900
parents eab161e557bd
children 0ef25958ac04
line wrap: on
line diff
--- a/src/main/java/christie/blockchain/BlockHeader.java	Fri Dec 28 16:45:38 2018 +0900
+++ b/src/main/java/christie/blockchain/BlockHeader.java	Tue Jan 01 15:07:22 2019 +0900
@@ -13,14 +13,20 @@
 
     private byte[] parentHash;
 
+    private long difficulty;
+
+    private long number;
+
     private long timestamp;
 
     private long nonce;
 
     HashUtil hashUtil = new HashUtil();
 
-    public BlockHeader(byte[] parentHash, long timestamp) {
+    public BlockHeader(byte[] parentHash, long difficulty, long number, long timestamp) {
         this.parentHash = parentHash;
+        this.difficulty = difficulty;
+        this.number = number;
         this.timestamp = timestamp;
     }
 
@@ -62,18 +68,35 @@
         return getHash(false);
     }
 
+    public void setTimestamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
     public long getTimestamp() {
         return timestamp;
     }
 
-    public void setTimestamp(long timestamp) {
-        this.timestamp = timestamp;
+    public void setNonce(long nonce) {
+        this.nonce = nonce;
     }
 
-    public void setNonce(long nonce) { this.nonce = nonce; }
-
     public long getNonce(){
         return this.nonce;
     }
 
+    public void setNumber(long number) {
+        this.number = number;
+    }
+
+    public long getNumber() {
+        return number;
+    }
+
+    public void setDifficulty(long difficulty) {
+        this.difficulty = difficulty;
+    }
+
+    public long getDifficulty() {
+        return difficulty;
+    }
 }