mirror of
https://github.com/gosticks/iota.lib.java.git
synced 2025-10-16 11:45:37 +00:00
bugfix
This commit is contained in:
parent
d14c793c0a
commit
81e8a09f94
@ -89,8 +89,14 @@ public class Bundle implements Comparable<Bundle> {
|
|||||||
* @param customCurl The custom curl.
|
* @param customCurl The custom curl.
|
||||||
*/
|
*/
|
||||||
public void finalize(ICurl customCurl) {
|
public void finalize(ICurl customCurl) {
|
||||||
|
ICurl curl;
|
||||||
ICurl curl = customCurl == null ? SpongeFactory.create(SpongeFactory.Mode.KERL) : customCurl;
|
int[] normalizedBundleValue;
|
||||||
|
int[] hash = new int[243];
|
||||||
|
int[] obsoleteTagTrits = new int[81];
|
||||||
|
String hashInTrytes;
|
||||||
|
boolean valid = true;
|
||||||
|
curl = customCurl == null ? SpongeFactory.create(SpongeFactory.Mode.KERL) : customCurl;
|
||||||
|
do {
|
||||||
curl.reset();
|
curl.reset();
|
||||||
|
|
||||||
for (int i = 0; i < this.getTransactions().size(); i++) {
|
for (int i = 0; i < this.getTransactions().size(); i++) {
|
||||||
@ -112,9 +118,22 @@ public class Bundle implements Comparable<Bundle> {
|
|||||||
curl.absorb(t, 0, t.length);
|
curl.absorb(t, 0, t.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] hash = new int[243];
|
|
||||||
curl.squeeze(hash, 0, hash.length);
|
curl.squeeze(hash, 0, hash.length);
|
||||||
String hashInTrytes = Converter.trytes(hash);
|
hashInTrytes = Converter.trytes(hash);
|
||||||
|
normalizedBundleValue = normalizedBundle(hashInTrytes);
|
||||||
|
|
||||||
|
boolean foundValue = false;
|
||||||
|
for (int i = 0; i < normalizedBundleValue.length; i++) {
|
||||||
|
if (normalizedBundleValue[i] == 13) {
|
||||||
|
foundValue = true;
|
||||||
|
obsoleteTagTrits = Converter.trits(this.getTransactions().get(0).getObsoleteTag());
|
||||||
|
Converter.increment(obsoleteTagTrits, 81);
|
||||||
|
this.getTransactions().get(0).setObsoleteTag(Converter.trytes(obsoleteTagTrits));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
valid = !foundValue;
|
||||||
|
|
||||||
|
} while (!valid);
|
||||||
|
|
||||||
for (int i = 0; i < this.getTransactions().size(); i++) {
|
for (int i = 0; i < this.getTransactions().size(); i++) {
|
||||||
this.getTransactions().get(i).setBundle(hashInTrytes);
|
this.getTransactions().get(i).setBundle(hashInTrytes);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user