|
@@ -12,16 +12,23 @@ public class Transaction {
|
12
|
12
|
|
13
|
13
|
@Id
|
14
|
14
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
15
|
|
- // private String transactionId;
|
|
15
|
+ private Long transactionId;
|
16
|
16
|
private String senderPublicKey;
|
17
|
17
|
private String recipientPublicKey;
|
18
|
18
|
private String transactionHash;
|
19
|
|
- private Float amount;
|
|
19
|
+ private Double amount;
|
20
|
20
|
//@OneToMany
|
21
|
21
|
//private List<Integer> coins;
|
22
|
22
|
//public Signature signature;
|
23
|
23
|
|
24
|
|
- public Transaction(String senderPublicKey, String recipientPublicKey, Float amount){
|
|
24
|
+ public Transaction(){
|
|
25
|
+
|
|
26
|
+ }
|
|
27
|
+
|
|
28
|
+ public Transaction(String senderPublicKey, String recipientPublicKey, Double amount){
|
|
29
|
+ this.senderPublicKey = senderPublicKey;
|
|
30
|
+ this.recipientPublicKey = recipientPublicKey;
|
|
31
|
+ this.amount = amount;
|
25
|
32
|
|
26
|
33
|
}
|
27
|
34
|
|
|
@@ -33,14 +40,12 @@ public class Transaction {
|
33
|
40
|
return recipientPublicKey;
|
34
|
41
|
}
|
35
|
42
|
|
36
|
|
- public Float getAmount() {
|
|
43
|
+ public Double getAmount() {
|
37
|
44
|
return amount;
|
38
|
45
|
}
|
39
|
46
|
|
40
|
|
-
|
41
|
|
-
|
42
|
47
|
public void calculateAndSetHash() {
|
43
|
|
- String transactionHash = DigestUtils.sha256Hex(senderPublicKey + recipientPublicKey + Float.toString(amount));
|
|
48
|
+ String transactionHash = DigestUtils.sha256Hex(senderPublicKey + recipientPublicKey + Double.toString(amount));
|
44
|
49
|
setTransactionHash(transactionHash);
|
45
|
50
|
}
|
46
|
51
|
|
|
@@ -48,16 +53,6 @@ public class Transaction {
|
48
|
53
|
this.transactionHash = transactionHash;
|
49
|
54
|
}
|
50
|
55
|
|
51
|
|
-
|
52
|
|
-// public Transaction(String from, String to, float amount/*,List<Integer> coins*/) {
|
53
|
|
-// this.sender = from;
|
54
|
|
-// this.recipient = to;
|
55
|
|
-// this.amount = amount;
|
56
|
|
-// //this.coins=coins;
|
57
|
|
-// }
|
58
|
|
-
|
59
|
|
-
|
60
|
|
-
|
61
|
56
|
// public void generateSignature(PrivateKey privateKey) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException {
|
62
|
57
|
// String data = StringUtil.getStringFromKey(sender) + StringUtil.getStringFromKey(reciepient) + Float.toString(value) ;
|
63
|
58
|
// signature = StringUtil.applyECDSASig(privateKey,data);
|