Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
d442d340
Unverified
Commit
d442d340
authored
Nov 23, 2020
by
Ralph Pichler
Committed by
GitHub
Nov 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove payment tolerance check (#987)
parent
27a54216
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
23 deletions
+0
-23
accounting.go
pkg/accounting/accounting.go
+0
-7
accounting_test.go
pkg/accounting/accounting_test.go
+0
-16
No files found.
pkg/accounting/accounting.go
View file @
d442d340
...
@@ -83,9 +83,6 @@ var (
...
@@ -83,9 +83,6 @@ var (
ErrOverdraft
=
errors
.
New
(
"attempted overdraft"
)
ErrOverdraft
=
errors
.
New
(
"attempted overdraft"
)
// ErrDisconnectThresholdExceeded denotes a peer has exceeded the disconnect threshold.
// ErrDisconnectThresholdExceeded denotes a peer has exceeded the disconnect threshold.
ErrDisconnectThresholdExceeded
=
errors
.
New
(
"disconnect threshold exceeded"
)
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 is the error returned if no balance in store exists for a peer
ErrPeerNoBalance
=
errors
.
New
(
"no balance for peer"
)
ErrPeerNoBalance
=
errors
.
New
(
"no balance for peer"
)
// ErrOverflow denotes an arithmetic operation overflowed.
// ErrOverflow denotes an arithmetic operation overflowed.
...
@@ -108,10 +105,6 @@ func NewAccounting(
...
@@ -108,10 +105,6 @@ func NewAccounting(
return
nil
,
fmt
.
Errorf
(
"tolerance plus threshold too big: %w"
,
ErrOverflow
)
return
nil
,
fmt
.
Errorf
(
"tolerance plus threshold too big: %w"
,
ErrOverflow
)
}
}
if
PaymentTolerance
>
PaymentThreshold
/
2
{
return
nil
,
ErrInvalidPaymentTolerance
}
return
&
Accounting
{
return
&
Accounting
{
accountingPeers
:
make
(
map
[
string
]
*
accountingPeer
),
accountingPeers
:
make
(
map
[
string
]
*
accountingPeer
),
paymentThreshold
:
PaymentThreshold
,
paymentThreshold
:
PaymentThreshold
,
...
...
pkg/accounting/accounting_test.go
View file @
d442d340
...
@@ -729,22 +729,6 @@ func TestAccountingNotifyPayment(t *testing.T) {
...
@@ -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
{
type
pricingMock
struct
{
called
bool
called
bool
peer
swarm
.
Address
peer
swarm
.
Address
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment