mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
sweepbatcher: add sweep batch
This commit is contained in:
parent
26e239c2c7
commit
56784ab921
4 changed files with 1421 additions and 0 deletions
|
|
@ -17,6 +17,8 @@ const (
|
|||
// loopInTimeout is the label used for loop in swaps to sweep an HTLC
|
||||
// that has timed out.
|
||||
loopInSweepTimeout = "InSweepTimeout"
|
||||
|
||||
loopOutBatchSweepSuccess = "BatchOutSweepSuccess -- %d"
|
||||
)
|
||||
|
||||
// LoopOutSweepSuccess returns the label used for loop out swaps to sweep the
|
||||
|
|
@ -25,6 +27,11 @@ func LoopOutSweepSuccess(swapHash string) string {
|
|||
return fmt.Sprintf(loopdLabelPattern, loopOutSweepSuccess, swapHash)
|
||||
}
|
||||
|
||||
// LoopOutBatchSweepSuccess returns the label used for loop out sweep batcher.
|
||||
func LoopOutBatchSweepSuccess(batchID int32) string {
|
||||
return fmt.Sprintf(loopOutBatchSweepSuccess, batchID)
|
||||
}
|
||||
|
||||
// LoopInHtlcLabel returns the label used for loop in swaps to publish an HTLC.
|
||||
func LoopInHtlcLabel(swapHash string) string {
|
||||
return fmt.Sprintf(loopdLabelPattern, loopInHtlc, swapHash)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/lightninglabs/loop/instantout/reservation"
|
||||
"github.com/lightninglabs/loop/liquidity"
|
||||
"github.com/lightninglabs/loop/loopdb"
|
||||
"github.com/lightninglabs/loop/sweepbatcher"
|
||||
"github.com/lightningnetwork/lnd"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/signal"
|
||||
|
|
@ -32,6 +33,7 @@ func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor) {
|
|||
|
||||
lnd.SetSubLogger(root, Subsystem, log)
|
||||
lnd.AddSubLogger(root, "LOOP", intercept, loop.UseLogger)
|
||||
lnd.AddSubLogger(root, "SWEEP", intercept, sweepbatcher.UseLogger)
|
||||
lnd.AddSubLogger(root, "LNDC", intercept, lndclient.UseLogger)
|
||||
lnd.AddSubLogger(root, "STORE", intercept, loopdb.UseLogger)
|
||||
lnd.AddSubLogger(root, lsat.Subsystem, intercept, lsat.UseLogger)
|
||||
|
|
|
|||
30
sweepbatcher/log.go
Normal file
30
sweepbatcher/log.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package sweepbatcher
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// log is a logger that is initialized with no output filters. This
|
||||
// means the package will not perform any logging by default until the
|
||||
// caller requests it.
|
||||
var log btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
UseLogger(build.NewSubLogger("SWEEP", nil))
|
||||
}
|
||||
|
||||
// batchPrefixLogger returns a logger that prefixes all log messages with the ID.
|
||||
func batchPrefixLogger(batchID string) btclog.Logger {
|
||||
return build.NewPrefixLog(fmt.Sprintf("[Batch %s]", batchID), log)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
// This should be used in preference to SetLogWriter if the caller is also
|
||||
// using btclog.
|
||||
func UseLogger(logger btclog.Logger) {
|
||||
log = logger
|
||||
}
|
||||
1382
sweepbatcher/sweep_batch.go
Normal file
1382
sweepbatcher/sweep_batch.go
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue