3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-14 19:25:51 +00:00

Transaction.toString(): Print incomplete transactions, too.

This commit is contained in:
Andreas Schildbach 2017-06-02 16:15:08 +02:00
parent 6841fceabc
commit 3fb4d6a1a3

View File

@ -658,10 +658,6 @@ public class Transaction extends ChildMessage {
if (isOptInFullRBF()) {
s.append(" opts into full replace-by-fee\n");
}
if (inputs.size() == 0) {
s.append(" INCOMPLETE: No inputs!\n");
return s.toString();
}
if (isCoinBase()) {
String script;
String script2;
@ -676,36 +672,41 @@ public class Transaction extends ChildMessage {
.append(") (scriptPubKey ").append(script2).append(")\n");
return s.toString();
}
for (TransactionInput in : inputs) {
s.append(" ");
s.append("in ");
if (!inputs.isEmpty()) {
for (TransactionInput in : inputs) {
s.append(" ");
s.append("in ");
try {
Script scriptSig = in.getScriptSig();
s.append(scriptSig);
if (in.getValue() != null)
s.append(" ").append(in.getValue().toFriendlyString());
s.append("\n ");
s.append("outpoint:");
final TransactionOutPoint outpoint = in.getOutpoint();
s.append(outpoint.toString());
final TransactionOutput connectedOutput = outpoint.getConnectedOutput();
if (connectedOutput != null) {
Script scriptPubKey = connectedOutput.getScriptPubKey();
if (scriptPubKey.isSentToAddress() || scriptPubKey.isPayToScriptHash()) {
s.append(" hash160:");
s.append(Utils.HEX.encode(scriptPubKey.getPubKeyHash()));
try {
Script scriptSig = in.getScriptSig();
s.append(scriptSig);
if (in.getValue() != null)
s.append(" ").append(in.getValue().toFriendlyString());
s.append("\n ");
s.append("outpoint:");
final TransactionOutPoint outpoint = in.getOutpoint();
s.append(outpoint.toString());
final TransactionOutput connectedOutput = outpoint.getConnectedOutput();
if (connectedOutput != null) {
Script scriptPubKey = connectedOutput.getScriptPubKey();
if (scriptPubKey.isSentToAddress() || scriptPubKey.isPayToScriptHash()) {
s.append(" hash160:");
s.append(Utils.HEX.encode(scriptPubKey.getPubKeyHash()));
}
}
if (in.hasSequence()) {
s.append("\n sequence:").append(Long.toHexString(in.getSequenceNumber()));
if (in.isOptInFullRBF())
s.append(", opts into full RBF");
}
} catch (Exception e) {
s.append("[exception: ").append(e.getMessage()).append("]");
}
if (in.hasSequence()) {
s.append("\n sequence:").append(Long.toHexString(in.getSequenceNumber()));
if (in.isOptInFullRBF())
s.append(", opts into full RBF");
}
} catch (Exception e) {
s.append("[exception: ").append(e.getMessage()).append("]");
s.append('\n');
}
s.append('\n');
} else {
s.append(" ");
s.append("INCOMPLETE: No inputs!\n");
}
for (TransactionOutput out : outputs) {
s.append(" ");