Class VtxoChainAutoFetchService
Background service that fetches and stores the virtual-tx chain for every new VTXO observed via VtxosChanged.
VTXOs arrive from multiple sources — batch settlement, change from a spend, incoming payment from another wallet, swap claim, sweep, etc. — and any of them can later need to be exited unilaterally. By subscribing to the storage-level event we capture them all uniformly, regardless of how they arrived.
Storage is opt-in — register via
services.AddVirtualTxAutoFetch(). With the auto-fetch off,
callers can still drive VirtualTxService manually
(e.g. only when starting an exit) if they prefer to defer the
indexer round-trips.
public class VtxoChainAutoFetchService : IHostedService, IDisposable
- Inheritance
-
VtxoChainAutoFetchService
- Implements
- Inherited Members
Constructors
VtxoChainAutoFetchService(IVtxoStorage, VirtualTxService, IOptions<VirtualTxOptions>, ILogger<VtxoChainAutoFetchService>?)
Background service that fetches and stores the virtual-tx chain for every new VTXO observed via VtxosChanged.
VTXOs arrive from multiple sources — batch settlement, change from a spend, incoming payment from another wallet, swap claim, sweep, etc. — and any of them can later need to be exited unilaterally. By subscribing to the storage-level event we capture them all uniformly, regardless of how they arrived.
Storage is opt-in — register via
services.AddVirtualTxAutoFetch(). With the auto-fetch off,
callers can still drive VirtualTxService manually
(e.g. only when starting an exit) if they prefer to defer the
indexer round-trips.
public VtxoChainAutoFetchService(IVtxoStorage vtxoStorage, VirtualTxService virtualTxService, IOptions<VirtualTxOptions> options, ILogger<VtxoChainAutoFetchService>? logger = null)
Parameters
vtxoStorageIVtxoStoragevirtualTxServiceVirtualTxServiceoptionsIOptions<VirtualTxOptions>loggerILogger<VtxoChainAutoFetchService>
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
StartAsync(CancellationToken)
Triggered when the application host is ready to start the service.
public Task StartAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenIndicates that the start process has been aborted.
Returns
StopAsync(CancellationToken)
Triggered when the application host is performing a graceful shutdown.
public Task StopAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenIndicates that the shutdown process should no longer be graceful.