mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-27 18:04:24 +01:00
load transaction details for outpoints of pending HTLCs in force-closing channels
This commit is contained in:
@@ -3,6 +3,7 @@ package de.cotto.lndmanagej.service;
|
||||
import de.cotto.lndmanagej.model.Channel;
|
||||
import de.cotto.lndmanagej.model.ChannelPoint;
|
||||
import de.cotto.lndmanagej.model.ClosedOrClosingChannel;
|
||||
import de.cotto.lndmanagej.model.ForceClosingChannel;
|
||||
import de.cotto.lndmanagej.transactions.service.TransactionService;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -33,7 +34,9 @@ public class TransactionBackgroundLoader {
|
||||
private Stream<String> getTransactionHashes() {
|
||||
Stream<String> openTransactionHashes = getOpenTransactionHashes();
|
||||
Stream<String> closeTransactionHashes = getCloseTransactionHashes();
|
||||
return Stream.concat(openTransactionHashes, closeTransactionHashes);
|
||||
Stream<String> htlcOutpointHashes = getHtlcOutpointHashes();
|
||||
return Stream.of(openTransactionHashes, closeTransactionHashes, htlcOutpointHashes)
|
||||
.flatMap(s -> s);
|
||||
}
|
||||
|
||||
private Stream<String> getOpenTransactionHashes() {
|
||||
@@ -54,4 +57,11 @@ public class TransactionBackgroundLoader {
|
||||
.map(ClosedOrClosingChannel::getCloseTransactionHash);
|
||||
}
|
||||
|
||||
private Stream<String> getHtlcOutpointHashes() {
|
||||
return channelService.getForceClosingChannels().stream()
|
||||
.map(ForceClosingChannel::getHtlcOutpoints)
|
||||
.flatMap(Collection::stream)
|
||||
.map(ChannelPoint::getTransactionHash);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user