Add isUnspent to JsonTxOutput

This commit is contained in:
Manfred Karrer 2018-09-28 19:58:03 -05:00
parent 3de2746834
commit 012dab9ad2
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
2 changed files with 7 additions and 4 deletions

View File

@ -233,6 +233,7 @@ public class ExportJsonFilesService implements DaoSetupService {
JsonTxOutputType txOutputType = JsonTxOutputType.valueOf(txOutput.getTxOutputType().name());
int lockTime = txOutput.getLockTime();
String opReturn = txOutput.getOpReturnData() != null ? Utils.HEX.encode(txOutput.getOpReturnData()) : null;
boolean isUnspent = bsqStateService.isUnspent(txOutput.getKey());
return new JsonTxOutput(tx.getId(),
txOutput.getIndex(),
bsqAmount,
@ -249,7 +250,8 @@ public class ExportJsonFilesService implements DaoSetupService {
txOutputType,
txOutputType.getDisplayString(),
opReturn,
lockTime
lockTime,
isUnspent
);
})
.collect(Collectors.toList());

View File

@ -41,11 +41,12 @@ class JsonTxOutput {
private final long time;
private final JsonTxType txType;
private final String txTypeDisplayString;
private final JsonTxOutputType txOutputType; // new
private final String txOutputTypeDisplayString; // new
private final JsonTxOutputType txOutputType;
private final String txOutputTypeDisplayString;
@Nullable
private final String opReturn;
private final int lockTime; // new
private final int lockTime;
private final boolean isUnspent;
String getId() {
return txId + ":" + index;