forked from Qortal/qortal
Added defensiveness in convertToSimpleTransaction()
This commit is contained in:
parent
9630625449
commit
d1f24d45da
@ -447,13 +447,15 @@ public abstract class Bitcoiny implements ForeignBlockchain {
|
|||||||
List<String> senders = t2.outputs.get(input.outputVout).addresses;
|
List<String> senders = t2.outputs.get(input.outputVout).addresses;
|
||||||
long inputAmount = t2.outputs.get(input.outputVout).value;
|
long inputAmount = t2.outputs.get(input.outputVout).value;
|
||||||
totalInputAmount += inputAmount;
|
totalInputAmount += inputAmount;
|
||||||
for (String sender : senders) {
|
if (senders != null) {
|
||||||
boolean addressInWallet = false;
|
for (String sender : senders) {
|
||||||
if (keySet.contains(sender)) {
|
boolean addressInWallet = false;
|
||||||
total += inputAmount;
|
if (keySet.contains(sender)) {
|
||||||
addressInWallet = true;
|
total += inputAmount;
|
||||||
|
addressInWallet = true;
|
||||||
|
}
|
||||||
|
inputs.add(new SimpleTransaction.Input(sender, inputAmount, addressInWallet));
|
||||||
}
|
}
|
||||||
inputs.add(new SimpleTransaction.Input(sender, inputAmount, addressInWallet));
|
|
||||||
}
|
}
|
||||||
} catch (ForeignBlockchainException e) {
|
} catch (ForeignBlockchainException e) {
|
||||||
LOGGER.trace("Failed to retrieve transaction information {}", input.outputTxHash);
|
LOGGER.trace("Failed to retrieve transaction information {}", input.outputTxHash);
|
||||||
@ -461,17 +463,19 @@ public abstract class Bitcoiny implements ForeignBlockchain {
|
|||||||
}
|
}
|
||||||
if (t.outputs != null && !t.outputs.isEmpty()) {
|
if (t.outputs != null && !t.outputs.isEmpty()) {
|
||||||
for (BitcoinyTransaction.Output output : t.outputs) {
|
for (BitcoinyTransaction.Output output : t.outputs) {
|
||||||
for (String address : output.addresses) {
|
if (output.addresses != null) {
|
||||||
boolean addressInWallet = false;
|
for (String address : output.addresses) {
|
||||||
if (keySet.contains(address)) {
|
boolean addressInWallet = false;
|
||||||
if (total > 0L) {
|
if (keySet.contains(address)) {
|
||||||
amount -= (total - output.value);
|
if (total > 0L) {
|
||||||
} else {
|
amount -= (total - output.value);
|
||||||
amount += output.value;
|
} else {
|
||||||
|
amount += output.value;
|
||||||
|
}
|
||||||
|
addressInWallet = true;
|
||||||
}
|
}
|
||||||
addressInWallet = true;
|
outputs.add(new SimpleTransaction.Output(address, output.value, addressInWallet));
|
||||||
}
|
}
|
||||||
outputs.add(new SimpleTransaction.Output(address, output.value, addressInWallet));
|
|
||||||
}
|
}
|
||||||
totalOutputAmount += output.value;
|
totalOutputAmount += output.value;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user