sweep: create add constraints

This refactor prepares for the addition of specific constraints for
force sweep inputs.
This commit is contained in:
Joost Jager committed 2020-01-15 16:56:42 +01:00
1 parent 16832cefa3
commit 14237f5fd4
2 files changed
+48 -22

No files matched your search

+4 -4
View File
@@ -24,13 +24,13 @@ func TestTxInputSet(t *testing.T) {
// Create a 300 sat input. The fee to sweep this input to a P2WKH output
// is 439 sats. That means that this input yields -139 sats and we
// expect it not to be added.
if set.add(createP2WKHInput(300), false) {
if set.add(createP2WKHInput(300), constraintsRegular) {
t.Fatal("expected add of negatively yielding input to fail")
}
// A 700 sat input should be accepted into the set, because it yields
// positively.
if !set.add(createP2WKHInput(700), false) {
if !set.add(createP2WKHInput(700), constraintsRegular) {
t.Fatal("expected add of positively yielding input to succeed")
}
@@ -45,7 +45,7 @@ func TestTxInputSet(t *testing.T) {
// Add a 1000 sat input. This increases the tx fee to 712 sats. The tx
// output should now be 1000+700 - 712 = 988 sats.
if !set.add(createP2WKHInput(1000), false) {
if !set.add(createP2WKHInput(1000), constraintsRegular) {
t.Fatal("expected add of positively yielding input to succeed")
}
if set.outputValue != 988 {
@@ -70,7 +70,7 @@ func TestTxInputSetFromWallet(t *testing.T) {
// Add a 700 sat input to the set. It yields positively, but doesn't
// reach the output dust limit.
if !set.add(createP2WKHInput(700), false) {
if !set.add(createP2WKHInput(700), constraintsRegular) {
t.Fatal("expected add of positively yielding input to succeed")
}
if set.dustLimitReached() {