diff --git a/watchtower/lookout/lookout_test.go b/watchtower/lookout/lookout_test.go index cf1c7960..893b3d7c 100644 --- a/watchtower/lookout/lookout_test.go +++ b/watchtower/lookout/lookout_test.go @@ -97,7 +97,8 @@ func TestLookoutBreachMatching(t *testing.T) { ID: makeArray33(1), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: rewardAndCommitType, + BlobType: rewardAndCommitType, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 10, }, @@ -107,7 +108,8 @@ func TestLookoutBreachMatching(t *testing.T) { ID: makeArray33(2), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: rewardAndCommitType, + BlobType: rewardAndCommitType, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 10, }, diff --git a/watchtower/wtclient/client_test.go b/watchtower/wtclient/client_test.go index b775e831..1bdc6dda 100644 --- a/watchtower/wtclient/client_test.go +++ b/watchtower/wtclient/client_test.go @@ -787,7 +787,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 20000, }, @@ -821,7 +821,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 20000, }, @@ -856,7 +856,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 5, }, @@ -923,7 +923,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 20000, }, @@ -1005,7 +1005,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 5, }, @@ -1063,7 +1063,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 1000, }, @@ -1107,7 +1107,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 5, }, @@ -1157,7 +1157,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 5, }, @@ -1215,7 +1215,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 5, }, @@ -1250,7 +1250,7 @@ var clientTests = []clientTest{ // Restart the client with a new policy, which will // immediately try to overwrite the prior session with // the old policy. - h.clientCfg.Policy.SweepFeeRate = 2 + h.clientCfg.Policy.SweepFeeRate *= 2 h.startClient() defer h.client.ForceQuit() @@ -1279,7 +1279,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 10, }, @@ -1339,7 +1339,7 @@ var clientTests = []clientTest{ policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ BlobType: blob.TypeAltruistCommit, - SweepFeeRate: 1, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 5, }, diff --git a/watchtower/wtdb/tower_db_test.go b/watchtower/wtdb/tower_db_test.go index 506f9b17..2eb03a22 100644 --- a/watchtower/wtdb/tower_db_test.go +++ b/watchtower/wtdb/tower_db_test.go @@ -186,7 +186,8 @@ func testMultipleMatches(h *towerDBHarness) { ID: id, Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -281,7 +282,8 @@ func testDeleteSession(h *towerDBHarness) { ID: *id0, Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -302,7 +304,8 @@ func testDeleteSession(h *towerDBHarness) { ID: *id1, Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -445,7 +448,8 @@ var stateUpdateExhaustSession = stateUpdateTest{ ID: *id(0), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -467,7 +471,8 @@ var stateUpdateSeqNumEqualLastApplied = stateUpdateTest{ ID: *id(0), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -489,7 +494,8 @@ var stateUpdateSeqNumLTLastApplied = stateUpdateTest{ ID: *id(0), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -510,7 +516,8 @@ var stateUpdateSeqNumZeroInvalid = stateUpdateTest{ ID: *id(0), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -529,7 +536,8 @@ var stateUpdateSkipSeqNum = stateUpdateTest{ ID: *id(0), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -548,7 +556,8 @@ var stateUpdateRevertSeqNum = stateUpdateTest{ ID: *id(0), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -569,7 +578,8 @@ var stateUpdateRevertLastApplied = stateUpdateTest{ ID: *id(0), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, @@ -591,7 +601,8 @@ var stateUpdateInvalidBlobSize = stateUpdateTest{ ID: *id(0), Policy: wtpolicy.Policy{ TxPolicy: wtpolicy.TxPolicy{ - BlobType: blob.TypeAltruistCommit, + BlobType: blob.TypeAltruistCommit, + SweepFeeRate: wtpolicy.DefaultSweepFeeRate, }, MaxUpdates: 3, }, diff --git a/watchtower/wtserver/server_test.go b/watchtower/wtserver/server_test.go index a6a087f0..0bb5806d 100644 --- a/watchtower/wtserver/server_test.go +++ b/watchtower/wtserver/server_test.go @@ -172,7 +172,7 @@ var createSessionTests = []createSessionTestCase{ MaxUpdates: 1000, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, expReply: &wtwire.CreateSessionReply{ Code: wtwire.CodeOK, @@ -194,7 +194,7 @@ var createSessionTests = []createSessionTestCase{ MaxUpdates: 1000, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, expReply: &wtwire.CreateSessionReply{ Code: wtwire.CodeOK, @@ -218,7 +218,7 @@ var createSessionTests = []createSessionTestCase{ MaxUpdates: 1000, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, expReply: &wtwire.CreateSessionReply{ Code: wtwire.CodeOK, @@ -240,7 +240,7 @@ var createSessionTests = []createSessionTestCase{ MaxUpdates: 1000, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, expReply: &wtwire.CreateSessionReply{ Code: wtwire.CreateSessionCodeRejectBlobType, @@ -355,7 +355,7 @@ var stateUpdateTests = []stateUpdateTestCase{ MaxUpdates: 3, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, updates: []*wtwire.StateUpdate{ {SeqNum: 1, LastApplied: 0, EncryptedBlob: testBlob}, @@ -385,7 +385,7 @@ var stateUpdateTests = []stateUpdateTestCase{ MaxUpdates: 4, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, updates: []*wtwire.StateUpdate{ {SeqNum: 2, LastApplied: 0, EncryptedBlob: testBlob}, @@ -409,7 +409,7 @@ var stateUpdateTests = []stateUpdateTestCase{ MaxUpdates: 4, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, updates: []*wtwire.StateUpdate{ {SeqNum: 1, LastApplied: 0, EncryptedBlob: testBlob}, @@ -437,7 +437,7 @@ var stateUpdateTests = []stateUpdateTestCase{ MaxUpdates: 4, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, updates: []*wtwire.StateUpdate{ {SeqNum: 1, LastApplied: 0, EncryptedBlob: testBlob}, @@ -465,7 +465,7 @@ var stateUpdateTests = []stateUpdateTestCase{ MaxUpdates: 4, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, updates: []*wtwire.StateUpdate{ {SeqNum: 1, LastApplied: 0, EncryptedBlob: testBlob}, @@ -495,7 +495,7 @@ var stateUpdateTests = []stateUpdateTestCase{ MaxUpdates: 4, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, updates: []*wtwire.StateUpdate{ {SeqNum: 1, LastApplied: 0, EncryptedBlob: testBlob}, @@ -525,7 +525,7 @@ var stateUpdateTests = []stateUpdateTestCase{ MaxUpdates: 4, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, updates: []*wtwire.StateUpdate{ {SeqNum: 1, LastApplied: 0, EncryptedBlob: testBlob}, @@ -556,7 +556,7 @@ var stateUpdateTests = []stateUpdateTestCase{ MaxUpdates: 3, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, updates: []*wtwire.StateUpdate{ {SeqNum: 1, LastApplied: 0, EncryptedBlob: testBlob}, @@ -586,7 +586,7 @@ var stateUpdateTests = []stateUpdateTestCase{ MaxUpdates: 3, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, }, updates: []*wtwire.StateUpdate{ {SeqNum: 0, LastApplied: 0, EncryptedBlob: testBlob}, @@ -723,7 +723,7 @@ func TestServerDeleteSession(t *testing.T) { MaxUpdates: 1000, RewardBase: 0, RewardRate: 0, - SweepFeeRate: 1, + SweepFeeRate: 10000, } const timeoutDuration = 100 * time.Millisecond