watchtower/wtdb: apply sanity checks to session policy before accepting

This commit is contained in:
Conner Fromknecht committed 2019-06-13 19:54:22 -07:00
1 parent 1979f9a7c0
commit 059887bd7b
3 files changed
+18

No files matched your search

+7
View File
@@ -150,6 +150,13 @@ func testInsertSession(h *towerDBHarness) {
RewardAddress: []byte{0x01, 0x02, 0x03},
}
// Try to insert the session, which should fail since the policy doesn't
// meet the current sanity checks.
h.insertSession(session, wtpolicy.ErrSweepFeeRateTooLow)
// Now assign a sane sweep fee rate to the policy, inserting should
// succeed.
session.Policy.SweepFeeRate = wtpolicy.DefaultSweepFeeRate
h.insertSession(session, nil)
session2 := h.getSession(&id, nil)