Skip to content

Commit

Permalink
sweep: add time-based sweeper
Browse files Browse the repository at this point in the history
In this commit, the sweep package is extended from just tx generation to
an active sweeper that collects sweep inputs and autonomously proceeds
to publish the sweep tx after the batch window time interval has passed
without new inputs being added.
  • Loading branch information
joostjager committed Dec 18, 2018
1 parent 1f06565 commit 01e64af
Show file tree
Hide file tree
Showing 3 changed files with 754 additions and 11 deletions.
14 changes: 14 additions & 0 deletions sweep/defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// +build !rpctest

package sweep

import (
"time"
)

var (
// DefaultBatchWindowDuration specifies duration of the sweep batch
// window. The sweep is held back during the batch window to allow more
// inputs to be added and thereby lower the fee per input.
DefaultBatchWindowDuration = 30 * time.Second
)
17 changes: 17 additions & 0 deletions sweep/defaults_rpctest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// +build rpctest

package sweep

import (
"time"
)

var (
// DefaultBatchWindowDuration specifies duration of the sweep batch
// window. The sweep is held back during the batch window to allow more
// inputs to be added and thereby lower the fee per input.
//
// To speed up integration tests waiting for a sweep to happen, the
// batch window is shortened.
DefaultBatchWindowDuration = 2 * time.Second
)
Loading

0 comments on commit 01e64af

Please sign in to comment.