Commit d442d340 authored by Ralph Pichler's avatar Ralph Pichler Committed by GitHub

remove payment tolerance check (#987)

parent 27a54216
......@@ -83,9 +83,6 @@ var (
ErrOverdraft = errors.New("attempted overdraft")
// ErrDisconnectThresholdExceeded denotes a peer has exceeded the disconnect threshold.
ErrDisconnectThresholdExceeded = errors.New("disconnect threshold exceeded")
// ErrInvalidPaymentTolerance denotes the payment tolerance is too high
// compared to the payment threshold.
ErrInvalidPaymentTolerance = errors.New("payment tolerance must be less than half the payment threshold")
// ErrPeerNoBalance is the error returned if no balance in store exists for a peer
ErrPeerNoBalance = errors.New("no balance for peer")
// ErrOverflow denotes an arithmetic operation overflowed.
......@@ -108,10 +105,6 @@ func NewAccounting(
return nil, fmt.Errorf("tolerance plus threshold too big: %w", ErrOverflow)
}
if PaymentTolerance > PaymentThreshold/2 {
return nil, ErrInvalidPaymentTolerance
}
return &Accounting{
accountingPeers: make(map[string]*accountingPeer),
paymentThreshold: PaymentThreshold,
......
......@@ -729,22 +729,6 @@ func TestAccountingNotifyPayment(t *testing.T) {
}
}
func TestAccountingInvalidPaymentTolerance(t *testing.T) {
logger := logging.New(ioutil.Discard, 0)
store := mock.NewStateStore()
defer store.Close()
_, err := accounting.NewAccounting(testPaymentThreshold, testPaymentThreshold/2+1, 1000, logger, store, nil, nil)
if err == nil {
t.Fatal("expected error")
}
if err != accounting.ErrInvalidPaymentTolerance {
t.Fatalf("got wrong error. got %v wanted %v", err, accounting.ErrInvalidPaymentTolerance)
}
}
type pricingMock struct {
called bool
peer swarm.Address
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment