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
67fa76eb
Unverified
Commit
67fa76eb
authored
May 31, 2021
by
Frank
Committed by
GitHub
May 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix comment typo (#1928)
parent
f621d41b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
accounting.go
pkg/accounting/accounting.go
+4
-4
accounting_test.go
pkg/accounting/accounting_test.go
+8
-8
doc.go
pkg/settlement/pseudosettle/doc.go
+1
-1
No files found.
pkg/accounting/accounting.go
View file @
67fa76eb
...
...
@@ -59,7 +59,7 @@ type Interface interface {
// Action represents an accounting action that can be applied
type
Action
interface
{
// Cleanup cleans up an action. Must be called wether it was applied or not.
// Cleanup cleans up an action. Must be called w
h
ether it was applied or not.
Cleanup
()
// Apply applies an action
Apply
()
error
...
...
@@ -106,11 +106,11 @@ type Accounting struct {
earlyPayment
*
big
.
Int
// Limit to disconnect peer after going in debt over
disconnectLimit
*
big
.
Int
// function used for monet
o
ry settlement
// function used for monet
a
ry settlement
payFunction
PayFunc
// function used for time settlement
refreshFunction
RefreshFunc
// allowance based on time used in pseudosettle
// allowance based on time used in pseudo
settle
refreshRate
*
big
.
Int
// lower bound for the value of issued cheques
minimumPayment
*
big
.
Int
...
...
@@ -290,7 +290,7 @@ func (a *Accounting) settle(peer swarm.Address, balance *accountingPeer) error {
paymentAmount
:=
new
(
big
.
Int
)
.
Neg
(
compensatedBalance
)
// Don't do anything if there is no actual debt or no time passed since last refreshment attempt
// This might be the case if the peer owes us and the total reserve for a peer exceeds the payment treshold.
// This might be the case if the peer owes us and the total reserve for a peer exceeds the payment t
h
reshold.
if
paymentAmount
.
Cmp
(
big
.
NewInt
(
0
))
>
0
&&
timeElapsed
>
0
{
shadowBalance
,
err
:=
a
.
shadowBalance
(
peer
)
if
err
!=
nil
{
...
...
pkg/accounting/accounting_test.go
View file @
67fa76eb
...
...
@@ -269,7 +269,7 @@ func TestAccountingCallSettlement(t *testing.T) {
t
.
Fatal
(
err
)
}
// Credit until payment treshold
// Credit until payment t
h
reshold
err
=
acc
.
Credit
(
peer1Addr
,
requestPrice
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -315,7 +315,7 @@ func TestAccountingCallSettlement(t *testing.T) {
t
.
Fatal
(
err
)
}
// Credit until the expected debt excee
e
ds payment threshold
// Credit until the expected debt exceeds payment threshold
expectedAmount
:=
testPaymentThreshold
.
Uint64
()
-
101
err
=
acc
.
Reserve
(
context
.
Background
(),
peer1Addr
,
expectedAmount
)
if
err
!=
nil
{
...
...
@@ -393,7 +393,7 @@ func TestAccountingCallSettlementMonetary(t *testing.T) {
t
.
Fatal
(
err
)
}
// Credit until payment treshold
// Credit until payment t
h
reshold
err
=
acc
.
Credit
(
peer1Addr
,
requestPrice
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -446,7 +446,7 @@ func TestAccountingCallSettlementMonetary(t *testing.T) {
return
big
.
NewInt
(
0
),
0
,
nil
})
// Credit until the expected debt excee
e
ds payment threshold
// Credit until the expected debt exceeds payment threshold
expectedAmount
:=
testPaymentThreshold
.
Uint64
()
err
=
acc
.
Reserve
(
context
.
Background
(),
peer1Addr
,
expectedAmount
)
...
...
@@ -510,7 +510,7 @@ func TestAccountingCallSettlementTooSoon(t *testing.T) {
t
.
Fatal
(
err
)
}
// Credit until payment treshold
// Credit until payment t
h
reshold
err
=
acc
.
Credit
(
peer1Addr
,
requestPrice
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -553,7 +553,7 @@ func TestAccountingCallSettlementTooSoon(t *testing.T) {
t
.
Fatal
(
err
)
}
// Credit until payment treshold
// Credit until payment t
h
reshold
err
=
acc
.
Credit
(
peer1Addr
,
requestPrice
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -742,7 +742,7 @@ func TestAccountingSurplusBalance(t *testing.T) {
t
.
Fatal
(
"Unexpected error from Credit"
)
}
debitAction
.
Cleanup
()
// sa
m
ity check surplus balance
// sa
n
ity check surplus balance
val
,
err
=
acc
.
SurplusBalance
(
peer1Addr
)
if
err
!=
nil
{
t
.
Fatal
(
"Error checking Surplusbalance"
)
...
...
@@ -765,7 +765,7 @@ func TestAccountingSurplusBalance(t *testing.T) {
t
.
Fatal
(
"Unexpected error from Debit"
)
}
debitAction
.
Cleanup
()
// sa
m
ity check surplus balance
// sa
n
ity check surplus balance
val
,
err
=
acc
.
SurplusBalance
(
peer1Addr
)
if
err
!=
nil
{
t
.
Fatal
(
"Error checking Surplusbalance"
)
...
...
pkg/settlement/pseudosettle/doc.go
View file @
67fa76eb
...
...
@@ -4,6 +4,6 @@
/*
Package pseudosettle implements a pretend settlement protocol where nodes send pretend payment messages consisting only of the payment amount.
Its purpose is to be able to have the full payment / disconnect treshold machinery in place without having to send cheques or real values.
Its purpose is to be able to have the full payment / disconnect t
h
reshold machinery in place without having to send cheques or real values.
*/
package
pseudosettle
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