Table of Contents

Class BlockchainMonitorService

Namespace
NLightning.Infrastructure.Bitcoin.Wallet
Assembly
NLightning.Infrastructure.Bitcoin.dll
public class BlockchainMonitorService : IBlockchainMonitor
Inheritance
BlockchainMonitorService
Implements
Inherited Members

Constructors

BlockchainMonitorService(IOptions<BitcoinOptions>, IBitcoinChainService, ILogger<BlockchainMonitorService>, IOptions<NodeOptions>, IServiceProvider)

public BlockchainMonitorService(IOptions<BitcoinOptions> bitcoinOptions, IBitcoinChainService bitcoinChainService, ILogger<BlockchainMonitorService> logger, IOptions<NodeOptions> nodeOptions, IServiceProvider serviceProvider)

Parameters

bitcoinOptions IOptions<BitcoinOptions>
bitcoinChainService IBitcoinChainService
logger ILogger<BlockchainMonitorService>
nodeOptions IOptions<NodeOptions>
serviceProvider IServiceProvider

Properties

LastProcessedBlockHeight

public uint LastProcessedBlockHeight { get; }

Property Value

uint

Methods

PublishAndWatchTransactionAsync(ChannelId, SignedTransaction, uint)

public Task PublishAndWatchTransactionAsync(ChannelId channelId, SignedTransaction signedTransaction, uint requiredDepth)

Parameters

channelId ChannelId
signedTransaction SignedTransaction
requiredDepth uint

Returns

Task

StartAsync(uint, CancellationToken)

Starts a background task to periodically refresh the fee rate

public Task StartAsync(uint heightOfBirth, CancellationToken cancellationToken)

Parameters

heightOfBirth uint

Wallet's height of birth to avoid processing old blocks

cancellationToken CancellationToken

Returns

Task

StopAsync()

Stops the background task and cancels any ongoing operations within the service.

public Task StopAsync()

Returns

Task

A task representing the asynchronous stop operation.

WatchBitcoinAddress(WalletAddressModel)

public void WatchBitcoinAddress(WalletAddressModel walletAddress)

Parameters

walletAddress WalletAddressModel

WatchTransactionAsync(ChannelId, TxId, uint)

public Task WatchTransactionAsync(ChannelId channelId, TxId txId, uint requiredDepth)

Parameters

channelId ChannelId
txId TxId
requiredDepth uint

Returns

Task

Events

OnNewBlockDetected

public event EventHandler<NewBlockEventArgs>? OnNewBlockDetected

Event Type

EventHandler<NewBlockEventArgs>

OnTransactionConfirmed

public event EventHandler<TransactionConfirmedEventArgs>? OnTransactionConfirmed

Event Type

EventHandler<TransactionConfirmedEventArgs>

OnWalletMovementDetected

public event EventHandler<WalletMovementEventArgs>? OnWalletMovementDetected

Event Type

EventHandler<WalletMovementEventArgs>