Commit 67fa76eb authored by Frank's avatar Frank Committed by GitHub

chore: fix comment typo (#1928)

parent f621d41b
...@@ -59,7 +59,7 @@ type Interface interface { ...@@ -59,7 +59,7 @@ type Interface interface {
// Action represents an accounting action that can be applied // Action represents an accounting action that can be applied
type Action interface { 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 whether it was applied or not.
Cleanup() Cleanup()
// Apply applies an action // Apply applies an action
Apply() error Apply() error
...@@ -106,11 +106,11 @@ type Accounting struct { ...@@ -106,11 +106,11 @@ type Accounting struct {
earlyPayment *big.Int earlyPayment *big.Int
// Limit to disconnect peer after going in debt over // Limit to disconnect peer after going in debt over
disconnectLimit *big.Int disconnectLimit *big.Int
// function used for monetory settlement // function used for monetary settlement
payFunction PayFunc payFunction PayFunc
// function used for time settlement // function used for time settlement
refreshFunction RefreshFunc refreshFunction RefreshFunc
// allowance based on time used in pseudosettle // allowance based on time used in pseudo settle
refreshRate *big.Int refreshRate *big.Int
// lower bound for the value of issued cheques // lower bound for the value of issued cheques
minimumPayment *big.Int minimumPayment *big.Int
...@@ -290,7 +290,7 @@ func (a *Accounting) settle(peer swarm.Address, balance *accountingPeer) error { ...@@ -290,7 +290,7 @@ func (a *Accounting) settle(peer swarm.Address, balance *accountingPeer) error {
paymentAmount := new(big.Int).Neg(compensatedBalance) paymentAmount := new(big.Int).Neg(compensatedBalance)
// Don't do anything if there is no actual debt or no time passed since last refreshment attempt // 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 threshold.
if paymentAmount.Cmp(big.NewInt(0)) > 0 && timeElapsed > 0 { if paymentAmount.Cmp(big.NewInt(0)) > 0 && timeElapsed > 0 {
shadowBalance, err := a.shadowBalance(peer) shadowBalance, err := a.shadowBalance(peer)
if err != nil { if err != nil {
......
...@@ -269,7 +269,7 @@ func TestAccountingCallSettlement(t *testing.T) { ...@@ -269,7 +269,7 @@ func TestAccountingCallSettlement(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// Credit until payment treshold // Credit until payment threshold
err = acc.Credit(peer1Addr, requestPrice) err = acc.Credit(peer1Addr, requestPrice)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
...@@ -315,7 +315,7 @@ func TestAccountingCallSettlement(t *testing.T) { ...@@ -315,7 +315,7 @@ func TestAccountingCallSettlement(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// Credit until the expected debt exceeeds payment threshold // Credit until the expected debt exceeds payment threshold
expectedAmount := testPaymentThreshold.Uint64() - 101 expectedAmount := testPaymentThreshold.Uint64() - 101
err = acc.Reserve(context.Background(), peer1Addr, expectedAmount) err = acc.Reserve(context.Background(), peer1Addr, expectedAmount)
if err != nil { if err != nil {
...@@ -393,7 +393,7 @@ func TestAccountingCallSettlementMonetary(t *testing.T) { ...@@ -393,7 +393,7 @@ func TestAccountingCallSettlementMonetary(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// Credit until payment treshold // Credit until payment threshold
err = acc.Credit(peer1Addr, requestPrice) err = acc.Credit(peer1Addr, requestPrice)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
...@@ -446,7 +446,7 @@ func TestAccountingCallSettlementMonetary(t *testing.T) { ...@@ -446,7 +446,7 @@ func TestAccountingCallSettlementMonetary(t *testing.T) {
return big.NewInt(0), 0, nil return big.NewInt(0), 0, nil
}) })
// Credit until the expected debt exceeeds payment threshold // Credit until the expected debt exceeds payment threshold
expectedAmount := testPaymentThreshold.Uint64() expectedAmount := testPaymentThreshold.Uint64()
err = acc.Reserve(context.Background(), peer1Addr, expectedAmount) err = acc.Reserve(context.Background(), peer1Addr, expectedAmount)
...@@ -510,7 +510,7 @@ func TestAccountingCallSettlementTooSoon(t *testing.T) { ...@@ -510,7 +510,7 @@ func TestAccountingCallSettlementTooSoon(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// Credit until payment treshold // Credit until payment threshold
err = acc.Credit(peer1Addr, requestPrice) err = acc.Credit(peer1Addr, requestPrice)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
...@@ -553,7 +553,7 @@ func TestAccountingCallSettlementTooSoon(t *testing.T) { ...@@ -553,7 +553,7 @@ func TestAccountingCallSettlementTooSoon(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// Credit until payment treshold // Credit until payment threshold
err = acc.Credit(peer1Addr, requestPrice) err = acc.Credit(peer1Addr, requestPrice)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
...@@ -742,7 +742,7 @@ func TestAccountingSurplusBalance(t *testing.T) { ...@@ -742,7 +742,7 @@ func TestAccountingSurplusBalance(t *testing.T) {
t.Fatal("Unexpected error from Credit") t.Fatal("Unexpected error from Credit")
} }
debitAction.Cleanup() debitAction.Cleanup()
// samity check surplus balance // sanity check surplus balance
val, err = acc.SurplusBalance(peer1Addr) val, err = acc.SurplusBalance(peer1Addr)
if err != nil { if err != nil {
t.Fatal("Error checking Surplusbalance") t.Fatal("Error checking Surplusbalance")
...@@ -765,7 +765,7 @@ func TestAccountingSurplusBalance(t *testing.T) { ...@@ -765,7 +765,7 @@ func TestAccountingSurplusBalance(t *testing.T) {
t.Fatal("Unexpected error from Debit") t.Fatal("Unexpected error from Debit")
} }
debitAction.Cleanup() debitAction.Cleanup()
// samity check surplus balance // sanity check surplus balance
val, err = acc.SurplusBalance(peer1Addr) val, err = acc.SurplusBalance(peer1Addr)
if err != nil { if err != nil {
t.Fatal("Error checking Surplusbalance") t.Fatal("Error checking Surplusbalance")
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
/* /*
Package pseudosettle implements a pretend settlement protocol where nodes send pretend payment messages consisting only of the payment amount. 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 threshold machinery in place without having to send cheques or real values.
*/ */
package pseudosettle package pseudosettle
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