aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/chequebook/cheque.go
diff options
context:
space:
mode:
authorEgon Elbre <egonelbre@gmail.com>2017-08-09 00:41:35 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-08-09 00:41:35 +0800
commit26b2d6e1aa25c847e452173b412b57d8a93c1eaa (patch)
tree54a8feb0e187e16ef2755a44be437cb3fe834a84 /contracts/chequebook/cheque.go
parentfff6e03a792b0e0a84943e2c3764c39b2840458a (diff)
downloadgo-tangerine-26b2d6e1aa25c847e452173b412b57d8a93c1eaa.tar.gz
go-tangerine-26b2d6e1aa25c847e452173b412b57d8a93c1eaa.tar.zst
go-tangerine-26b2d6e1aa25c847e452173b412b57d8a93c1eaa.zip
contracts: fix megacheck errors (#14916)
* contracts: fix megacheck errors * contracts: drop useless sleep, lets see what breaks
Diffstat (limited to 'contracts/chequebook/cheque.go')
-rw-r--r--contracts/chequebook/cheque.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/contracts/chequebook/cheque.go b/contracts/chequebook/cheque.go
index bd635705e..09daa9248 100644
--- a/contracts/chequebook/cheque.go
+++ b/contracts/chequebook/cheque.go
@@ -376,12 +376,12 @@ func (self *Chequebook) autoDeposit(interval time.Duration) {
ticker := time.NewTicker(interval)
self.quit = make(chan bool)
quit := self.quit
+
go func() {
- FOR:
for {
select {
case <-quit:
- break FOR
+ return
case <-ticker.C:
self.lock.Lock()
if self.balance.Cmp(self.buffer) < 0 {
@@ -395,7 +395,6 @@ func (self *Chequebook) autoDeposit(interval time.Duration) {
}
}
}()
- return
}
// Outbox can issue cheques from a single contract to a single beneficiary.
@@ -436,7 +435,6 @@ type Inbox struct {
sender common.Address // local peer's address to send cashing tx from
signer *ecdsa.PublicKey // peer's public key
txhash string // tx hash of last cashing tx
- abigen bind.ContractBackend // blockchain API
session *contract.ChequebookSession // abi contract backend with tx opts
quit chan bool // when closed causes autocash to stop
maxUncashed *big.Int // threshold that triggers autocashing
@@ -525,12 +523,12 @@ func (self *Inbox) autoCash(cashInterval time.Duration) {
ticker := time.NewTicker(cashInterval)
self.quit = make(chan bool)
quit := self.quit
+
go func() {
- FOR:
for {
select {
case <-quit:
- break FOR
+ return
case <-ticker.C:
self.lock.Lock()
if self.cheque != nil && self.cheque.Amount.Cmp(self.cashed) != 0 {
@@ -543,7 +541,6 @@ func (self *Inbox) autoCash(cashInterval time.Duration) {
}
}
}()
- return
}
// Receive is called to deposit the latest cheque to the incoming Inbox.