add log trace for saveUtxo
@@ -31,6 +31,7 @@ import io.nuls.account.ledger.storage.service.LocalUtxoStorageService;
import io.nuls.account.ledger.storage.service.UnconfirmedTransactionStorageService;
import io.nuls.core.tools.array.ArraysTool;
import io.nuls.core.tools.crypto.Hex;
+import io.nuls.core.tools.log.Log;
import io.nuls.kernel.constant.KernelErrorCode;
import io.nuls.kernel.exception.NulsRuntimeException;
import io.nuls.kernel.lite.annotation.Autowired;
@@ -124,7 +125,7 @@ public class LocalUtxoServiceImpl implements LocalUtxoService {
byte[] outKey = ArraysTool.joinintTogether(tos.get(i).getOwner(), txHashBytes, new VarInt(i).encode());
toMap.put(outKey, to.serialize());
} catch (IOException e) {
-
+ Log.error(e);
}
}
Result result = localUtxoStorageService.batchSaveAndDeleteUTXO(toMap, fromsSet);
@@ -176,6 +177,12 @@ public class LocalUtxoServiceImpl implements LocalUtxoService {
// save utxo - to
List<Coin> tos = coinData.getTo();
Map<byte[], byte[]> toMap = new HashMap<>();
+ byte[] txHashBytes = null;
+ try {
+ txHashBytes = tx.getHash().serialize();
+ } catch (IOException e) {
+ throw new NulsRuntimeException(e);
+ }
for (int i = 0, length = tos.size(); i < length; i++) {
Coin to = tos.get(i);
@@ -184,9 +191,9 @@ public class LocalUtxoServiceImpl implements LocalUtxoService {
}
try {
- byte[] outKey = ArraysTool.joinintTogether(tos.get(i).getOwner(), tx.getHash().serialize(), new VarInt(i).encode());
+ byte[] outKey = ArraysTool.joinintTogether(tos.get(i).getOwner(), txHashBytes, new VarInt(i).encode());
if (to.getLockTime() == -1L) {
- byte[] toKey = ArraysTool.joinintTogether(tx.getHash().serialize(), new VarInt(i).encode());
+ byte[] toKey = ArraysTool.joinintTogether(txHashBytes, new VarInt(i).encode());
Coin ledgerCoin = ledgerService.getUtxo(toKey);
if (null != ledgerCoin) {
