Skip to content
Snippets Groups Projects
Commit 556acf46 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

Add a log (warn) to find the origin of issuer #17

parent 905b1d91
Branches
Tags
No related merge requests found
......@@ -23,10 +23,11 @@ package org.duniter.core.client.model.bma;
*/
import org.duniter.core.util.Preconditions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.math.BigInteger;
import java.util.*;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -38,6 +39,8 @@ import java.util.stream.IntStream;
*/
public final class BlockchainBlocks {
private static final Logger log = LoggerFactory.getLogger(BlockchainBlocks.class);
public static final Pattern SIG_PUBKEY_PATTERN = Pattern.compile("SIG\\(([^)]+)\\)");
public static final Pattern TX_INPUT_CONDITION_FUNCTION = Pattern.compile("(SIG|XHX)\\(([^)]+)\\)");
......@@ -112,10 +115,20 @@ public final class BlockchainBlocks {
Preconditions.checkNotNull(tx);
final Map<Integer, List<String>> inputIssuers = getInputIssuers(tx);
if (inputIssuers == null || inputIssuers.size() == 0) {
log.warn("Invalid block TX: no issuer found ! ", tx.toString());
}
return IntStream.range(0, tx.getInputs().length)
.mapToObj(i -> {
TxInput txInput = parseInput(tx.getInputs()[i]);
if (txInput == null) {
log.warn(String.format("Invalid block TX: unable to parse inputs: %s", i, tx.getInputs()[i]));
txInput = new TxInput();
txInput.amount = 0;
txInput.unitbase = 0;
txInput.type = "T";
}
txInput.issuers = inputIssuers.get(i);
return txInput;
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment