preserve txo status when updating node outputs

This commit is contained in:
Craig Raw 2022-05-19 16:34:14 +02:00
parent d24243ce20
commit 8e50815a3f

View file

@ -138,6 +138,8 @@ public class WalletNode extends Persistable implements Comparable<WalletNode> {
if(!transactionOutputs.isEmpty()) { if(!transactionOutputs.isEmpty()) {
Optional<String> optionalLabel = transactionOutputs.stream().filter(oldTxo -> oldTxo.getHash().equals(txo.getHash()) && oldTxo.getIndex() == txo.getIndex()).map(BlockTransactionHash::getLabel).filter(Objects::nonNull).findFirst(); Optional<String> optionalLabel = transactionOutputs.stream().filter(oldTxo -> oldTxo.getHash().equals(txo.getHash()) && oldTxo.getIndex() == txo.getIndex()).map(BlockTransactionHash::getLabel).filter(Objects::nonNull).findFirst();
optionalLabel.ifPresent(txo::setLabel); optionalLabel.ifPresent(txo::setLabel);
Optional<Status> optionalStatus = transactionOutputs.stream().filter(oldTxo -> oldTxo.getHash().equals(txo.getHash()) && oldTxo.getIndex() == txo.getIndex()).map(BlockTransactionHashIndex::getStatus).filter(Objects::nonNull).findFirst();
optionalStatus.ifPresent(txo::setStatus);
} }
if(!wallet.getDetachedLabels().isEmpty()) { if(!wallet.getDetachedLabels().isEmpty()) {