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
0d835e5a
Unverified
Commit
0d835e5a
authored
Jul 01, 2021
by
Esad
Committed by
GitHub
Jul 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: deep source (#2281)
parent
ea882b52
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
16 additions
and
16 deletions
+16
-16
pricing.go
pkg/pricing/pricing.go
+1
-1
pushsync.go
pkg/pushsync/pushsync.go
+1
-1
pseudosettle.go
pkg/settlement/pseudosettle/pseudosettle.go
+1
-1
pseudosettle_test.go
pkg/settlement/pseudosettle/pseudosettle_test.go
+1
-1
chequestore.go
pkg/settlement/swap/chequebook/chequestore.go
+2
-2
factory.go
pkg/settlement/swap/chequebook/factory.go
+1
-1
chequestore.go
pkg/settlement/swap/chequestore/mock/chequestore.go
+1
-1
utilities.go
pkg/settlement/swap/headers/utilities.go
+1
-1
swap.go
pkg/settlement/swap/mock/swap.go
+1
-1
priceoracle.go
pkg/settlement/swap/priceoracle/mock/priceoracle.go
+3
-3
priceoracle.go
pkg/settlement/swap/priceoracle/priceoracle.go
+1
-1
swap.go
pkg/settlement/swap/swap.go
+1
-1
swapprotocol.go
pkg/settlement/swap/swapprotocol/swapprotocol.go
+1
-1
No files found.
pkg/pricing/pricing.go
View file @
0d835e5a
...
...
@@ -49,7 +49,7 @@ type Service struct {
paymentThresholdObserver
PaymentThresholdObserver
}
func
New
(
streamer
p2p
.
Streamer
,
logger
logging
.
Logger
,
paymentThreshold
*
big
.
Int
,
minThreshold
*
big
.
Int
)
*
Service
{
func
New
(
streamer
p2p
.
Streamer
,
logger
logging
.
Logger
,
paymentThreshold
,
minThreshold
*
big
.
Int
)
*
Service
{
return
&
Service
{
streamer
:
streamer
,
logger
:
logger
,
...
...
pkg/pushsync/pushsync.go
View file @
0d835e5a
...
...
@@ -516,7 +516,7 @@ func newPeerSkipList() *peerSkipList {
}
}
func
(
l
*
peerSkipList
)
Add
(
peer
swarm
.
Address
,
chunk
swarm
.
Address
,
expire
time
.
Duration
)
{
func
(
l
*
peerSkipList
)
Add
(
peer
,
chunk
swarm
.
Address
,
expire
time
.
Duration
)
{
l
.
Lock
()
defer
l
.
Unlock
()
...
...
pkg/settlement/pseudosettle/pseudosettle.go
View file @
0d835e5a
...
...
@@ -239,7 +239,7 @@ func (s *Service) handler(ctx context.Context, p p2p.Peer, stream p2p.Stream) (e
}
// Pay initiates a payment to the given peer
func
(
s
*
Service
)
Pay
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
amount
*
big
.
Int
,
checkAllowance
*
big
.
Int
)
(
*
big
.
Int
,
int64
,
error
)
{
func
(
s
*
Service
)
Pay
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
amount
,
checkAllowance
*
big
.
Int
)
(
*
big
.
Int
,
int64
,
error
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
5
*
time
.
Second
)
defer
cancel
()
...
...
pkg/settlement/pseudosettle/pseudosettle_test.go
View file @
0d835e5a
...
...
@@ -41,7 +41,7 @@ type notifyPaymentSentCall struct {
err
error
}
func
newTestObserver
(
debtAmounts
map
[
string
]
*
big
.
Int
,
shadowBalanceAmounts
map
[
string
]
*
big
.
Int
)
*
testObserver
{
func
newTestObserver
(
debtAmounts
,
shadowBalanceAmounts
map
[
string
]
*
big
.
Int
)
*
testObserver
{
return
&
testObserver
{
receivedCalled
:
make
(
chan
notifyPaymentReceivedCall
,
1
),
sentCalled
:
make
(
chan
notifyPaymentSentCall
,
1
),
...
...
pkg/settlement/swap/chequebook/chequestore.go
View file @
0d835e5a
...
...
@@ -41,7 +41,7 @@ var (
// ChequeStore handles the verification and storage of received cheques
type
ChequeStore
interface
{
// ReceiveCheque verifies and stores a cheque. It returns the total amount earned.
ReceiveCheque
(
ctx
context
.
Context
,
cheque
*
SignedCheque
,
exchangeRate
*
big
.
Int
,
deduction
*
big
.
Int
)
(
*
big
.
Int
,
error
)
ReceiveCheque
(
ctx
context
.
Context
,
cheque
*
SignedCheque
,
exchangeRate
,
deduction
*
big
.
Int
)
(
*
big
.
Int
,
error
)
// LastCheque returns the last cheque we received from a specific chequebook.
LastCheque
(
chequebook
common
.
Address
)
(
*
SignedCheque
,
error
)
// LastCheques returns the last received cheques from every known chequebook.
...
...
@@ -98,7 +98,7 @@ func (s *chequeStore) LastCheque(chequebook common.Address) (*SignedCheque, erro
}
// ReceiveCheque verifies and stores a cheque. It returns the totam amount earned.
func
(
s
*
chequeStore
)
ReceiveCheque
(
ctx
context
.
Context
,
cheque
*
SignedCheque
,
exchangeRate
*
big
.
Int
,
deduction
*
big
.
Int
)
(
*
big
.
Int
,
error
)
{
func
(
s
*
chequeStore
)
ReceiveCheque
(
ctx
context
.
Context
,
cheque
*
SignedCheque
,
exchangeRate
,
deduction
*
big
.
Int
)
(
*
big
.
Int
,
error
)
{
// verify we are the beneficiary
if
cheque
.
Beneficiary
!=
s
.
beneficiary
{
return
nil
,
ErrWrongBeneficiary
...
...
pkg/settlement/swap/chequebook/factory.go
View file @
0d835e5a
...
...
@@ -141,7 +141,7 @@ LOOP:
return
nil
}
func
(
c
*
factory
)
verifyChequebookAgainstFactory
(
ctx
context
.
Context
,
factory
common
.
Address
,
chequebook
common
.
Address
)
(
bool
,
error
)
{
func
(
c
*
factory
)
verifyChequebookAgainstFactory
(
ctx
context
.
Context
,
factory
,
chequebook
common
.
Address
)
(
bool
,
error
)
{
callData
,
err
:=
factoryABI
.
Pack
(
"deployedContracts"
,
chequebook
)
if
err
!=
nil
{
return
false
,
err
...
...
pkg/settlement/swap/chequestore/mock/chequestore.go
View file @
0d835e5a
...
...
@@ -46,7 +46,7 @@ func NewChequeStore(opts ...Option) chequebook.ChequeStore {
return
mock
}
func
(
s
*
Service
)
ReceiveCheque
(
ctx
context
.
Context
,
cheque
*
chequebook
.
SignedCheque
,
exchangeRate
*
big
.
Int
,
deduction
*
big
.
Int
)
(
*
big
.
Int
,
error
)
{
func
(
s
*
Service
)
ReceiveCheque
(
ctx
context
.
Context
,
cheque
*
chequebook
.
SignedCheque
,
exchangeRate
,
deduction
*
big
.
Int
)
(
*
big
.
Int
,
error
)
{
return
s
.
receiveCheque
(
ctx
,
cheque
,
exchangeRate
,
deduction
)
}
...
...
pkg/settlement/swap/headers/utilities.go
View file @
0d835e5a
...
...
@@ -33,7 +33,7 @@ func MakeSettlementHeaders(exchangeRate, deduction *big.Int) p2p.Headers {
}
}
func
ParseSettlementResponseHeaders
(
receivedHeaders
p2p
.
Headers
)
(
exchange
*
big
.
Int
,
deduction
*
big
.
Int
,
err
error
)
{
func
ParseSettlementResponseHeaders
(
receivedHeaders
p2p
.
Headers
)
(
exchange
,
deduction
*
big
.
Int
,
err
error
)
{
exchangeRate
,
err
:=
ParseExchangeHeader
(
receivedHeaders
)
if
err
!=
nil
{
...
...
pkg/settlement/swap/mock/swap.go
View file @
0d835e5a
...
...
@@ -247,7 +247,7 @@ func (s *Service) CashoutStatus(ctx context.Context, peer swarm.Address) (*chequ
return
nil
,
nil
}
func
(
s
*
Service
)
ReceiveCheque
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
cheque
*
chequebook
.
SignedCheque
,
exchangeRate
*
big
.
Int
,
deduction
*
big
.
Int
)
(
err
error
)
{
func
(
s
*
Service
)
ReceiveCheque
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
cheque
*
chequebook
.
SignedCheque
,
exchangeRate
,
deduction
*
big
.
Int
)
(
err
error
)
{
defer
func
()
{
if
err
==
nil
{
s
.
deductionForPeers
[
peer
.
String
()]
=
struct
{}{}
...
...
pkg/settlement/swap/priceoracle/mock/priceoracle.go
View file @
0d835e5a
...
...
@@ -16,7 +16,7 @@ type Service struct {
deduct
*
big
.
Int
}
func
New
(
rate
*
big
.
Int
,
deduct
*
big
.
Int
)
Service
{
func
New
(
rate
,
deduct
*
big
.
Int
)
Service
{
return
Service
{
rate
:
rate
,
deduct
:
deduct
,
...
...
@@ -30,7 +30,7 @@ func (s Service) GetPrice(ctx context.Context) (*big.Int, *big.Int, error) {
return
s
.
rate
,
s
.
deduct
,
nil
}
func
(
s
Service
)
CurrentRates
()
(
exchangeRate
*
big
.
Int
,
deduction
*
big
.
Int
,
err
error
)
{
func
(
s
Service
)
CurrentRates
()
(
exchangeRate
,
deduction
*
big
.
Int
,
err
error
)
{
return
s
.
rate
,
s
.
deduct
,
nil
}
...
...
@@ -42,7 +42,7 @@ func DiscoverPriceOracleAddress(chainID int64) (priceOracleAddress common.Addres
return
common
.
Address
{},
false
}
func
(
s
Service
)
SetValues
(
rate
*
big
.
Int
,
deduct
*
big
.
Int
)
{
func
(
s
Service
)
SetValues
(
rate
,
deduct
*
big
.
Int
)
{
s
.
rate
=
rate
s
.
deduct
=
deduct
}
pkg/settlement/swap/priceoracle/priceoracle.go
View file @
0d835e5a
...
...
@@ -131,7 +131,7 @@ func (s *service) GetPrice(ctx context.Context) (*big.Int, *big.Int, error) {
return
exchangeRate
,
deduction
,
nil
}
func
(
s
*
service
)
CurrentRates
()
(
exchangeRate
*
big
.
Int
,
deduction
*
big
.
Int
,
err
error
)
{
func
(
s
*
service
)
CurrentRates
()
(
exchangeRate
,
deduction
*
big
.
Int
,
err
error
)
{
if
s
.
exchangeRate
.
Cmp
(
big
.
NewInt
(
0
))
==
0
{
return
nil
,
nil
,
errors
.
New
(
"exchange rate not yet available"
)
}
...
...
pkg/settlement/swap/swap.go
View file @
0d835e5a
...
...
@@ -75,7 +75,7 @@ func New(proto swapprotocol.Interface, logger logging.Logger, store storage.Stat
}
// ReceiveCheque is called by the swap protocol if a cheque is received.
func
(
s
*
Service
)
ReceiveCheque
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
cheque
*
chequebook
.
SignedCheque
,
exchangeRate
*
big
.
Int
,
deduction
*
big
.
Int
)
(
err
error
)
{
func
(
s
*
Service
)
ReceiveCheque
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
cheque
*
chequebook
.
SignedCheque
,
exchangeRate
,
deduction
*
big
.
Int
)
(
err
error
)
{
// check this is the same chequebook for this peer as previously
expectedChequebook
,
known
,
err
:=
s
.
addressbook
.
Chequebook
(
peer
)
if
err
!=
nil
{
...
...
pkg/settlement/swap/swapprotocol/swapprotocol.go
View file @
0d835e5a
...
...
@@ -50,7 +50,7 @@ type Interface interface {
// Swap is the interface the settlement layer should implement to receive cheques.
type
Swap
interface
{
// ReceiveCheque is called by the swap protocol if a cheque is received.
ReceiveCheque
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
cheque
*
chequebook
.
SignedCheque
,
exchangeRate
*
big
.
Int
,
deduction
*
big
.
Int
)
error
ReceiveCheque
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
cheque
*
chequebook
.
SignedCheque
,
exchangeRate
,
deduction
*
big
.
Int
)
error
// Handshake is called by the swap protocol when a handshake is received.
Handshake
(
peer
swarm
.
Address
,
beneficiary
common
.
Address
)
error
GetDeductionForPeer
(
peer
swarm
.
Address
)
(
bool
,
error
)
...
...
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