This commit is contained in:
Andreas Schildbach 2025-03-11 12:21:09 -05:00 committed by GitHub
commit fce493d36e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -769,7 +769,6 @@ public class Transaction extends BaseMessage {
if (isCoinBase()) {
s.append(indent).append("coinbase\n");
} else if (!inputs.isEmpty()) {
int i = 0;
for (TransactionInput in : inputs) {
s.append(indent).append(" ");
s.append("in ");
@ -811,9 +810,16 @@ public class Transaction extends BaseMessage {
s.append('\n');
}
} catch (Exception e) {
s.append("[exception: ").append(e.getMessage()).append("]\n");
s.append(ByteUtils.formatHex(getInput(0).getScriptBytes()));
if (!isCoinBase()) {
final Coin value = in.getValue();
if (value != null)
s.append(" ").append(value.toFriendlyString());
s.append('\n');
s.append(indent).append(" exception: ").append(e.getMessage());
}
s.append('\n');
}
i++;
}
} else {
s.append(indent).append(" ");

View file

@ -515,7 +515,7 @@ public class TransactionTest {
};
tx.addInput(ti);
assertTrue(tx.toString().contains("[exception: "));
assertTrue(tx.toString().contains("exception: "));
}
@Test