diff options
author | gary rong <garyrong0905@gmail.com> | 2019-06-28 15:34:02 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-06-28 15:34:02 +0800 |
commit | f7cdea2bdcd7ff3cec99731cb912cde0b233d6c9 (patch) | |
tree | b463c8dd42547edceb778d946927d2c363303324 /les/txrelay.go | |
parent | 702f52fb99d60b4b6bab05799c14dafdd8648854 (diff) | |
download | go-tangerine-f7cdea2bdcd7ff3cec99731cb912cde0b233d6c9.tar go-tangerine-f7cdea2bdcd7ff3cec99731cb912cde0b233d6c9.tar.gz go-tangerine-f7cdea2bdcd7ff3cec99731cb912cde0b233d6c9.tar.bz2 go-tangerine-f7cdea2bdcd7ff3cec99731cb912cde0b233d6c9.tar.lz go-tangerine-f7cdea2bdcd7ff3cec99731cb912cde0b233d6c9.tar.xz go-tangerine-f7cdea2bdcd7ff3cec99731cb912cde0b233d6c9.tar.zst go-tangerine-f7cdea2bdcd7ff3cec99731cb912cde0b233d6c9.zip |
all: on-chain oracle checkpoint syncing (#19543)
* all: implement simple checkpoint syncing
cmd, les, node: remove callback mechanism
cmd, node: remove callback definition
les: simplify the registrar
les: expose checkpoint rpc services in the light client
les, light: don't store untrusted receipt
cmd, contracts, les: discard stale checkpoint
cmd, contracts/registrar: loose restriction of registeration
cmd, contracts: add replay-protection
all: off-chain multi-signature contract
params: deploy checkpoint contract for rinkeby
cmd/registrar: add raw signing mode for registrar
cmd/registrar, contracts/registrar, les: fixed messages
* cmd/registrar, contracts/registrar: fix lints
* accounts/abi/bind, les: address comments
* cmd, contracts, les, light, params: minor checkpoint sync cleanups
* cmd, eth, les, light: move checkpoint config to config file
* cmd, eth, les, params: address comments
* eth, les, params: address comments
* cmd: polish up the checkpoint admin CLI
* cmd, contracts, params: deploy new version contract
* cmd/checkpoint-admin: add another flag for clef mode signing
* cmd, contracts, les: rename and regen checkpoint oracle with abigen
Diffstat (limited to 'les/txrelay.go')
-rw-r--r-- | les/txrelay.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/les/txrelay.go b/les/txrelay.go index 5ebef1c22..ffbe251fc 100644 --- a/les/txrelay.go +++ b/les/txrelay.go @@ -30,7 +30,7 @@ type ltrInfo struct { sentTo map[*peer]struct{} } -type LesTxRelay struct { +type lesTxRelay struct { txSent map[common.Hash]*ltrInfo txPending map[common.Hash]struct{} ps *peerSet @@ -42,8 +42,8 @@ type LesTxRelay struct { retriever *retrieveManager } -func NewLesTxRelay(ps *peerSet, retriever *retrieveManager) *LesTxRelay { - r := &LesTxRelay{ +func newLesTxRelay(ps *peerSet, retriever *retrieveManager) *lesTxRelay { + r := &lesTxRelay{ txSent: make(map[common.Hash]*ltrInfo), txPending: make(map[common.Hash]struct{}), ps: ps, @@ -54,18 +54,18 @@ func NewLesTxRelay(ps *peerSet, retriever *retrieveManager) *LesTxRelay { return r } -func (self *LesTxRelay) Stop() { +func (self *lesTxRelay) Stop() { close(self.stop) } -func (self *LesTxRelay) registerPeer(p *peer) { +func (self *lesTxRelay) registerPeer(p *peer) { self.lock.Lock() defer self.lock.Unlock() self.peerList = self.ps.AllPeers() } -func (self *LesTxRelay) unregisterPeer(p *peer) { +func (self *lesTxRelay) unregisterPeer(p *peer) { self.lock.Lock() defer self.lock.Unlock() @@ -74,7 +74,7 @@ func (self *LesTxRelay) unregisterPeer(p *peer) { // send sends a list of transactions to at most a given number of peers at // once, never resending any particular transaction to the same peer twice -func (self *LesTxRelay) send(txs types.Transactions, count int) { +func (self *lesTxRelay) send(txs types.Transactions, count int) { sendTo := make(map[*peer]types.Transactions) self.peerStartPos++ // rotate the starting position of the peer list @@ -143,14 +143,14 @@ func (self *LesTxRelay) send(txs types.Transactions, count int) { } } -func (self *LesTxRelay) Send(txs types.Transactions) { +func (self *lesTxRelay) Send(txs types.Transactions) { self.lock.Lock() defer self.lock.Unlock() self.send(txs, 3) } -func (self *LesTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback []common.Hash) { +func (self *lesTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback []common.Hash) { self.lock.Lock() defer self.lock.Unlock() @@ -173,7 +173,7 @@ func (self *LesTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback } } -func (self *LesTxRelay) Discard(hashes []common.Hash) { +func (self *lesTxRelay) Discard(hashes []common.Hash) { self.lock.Lock() defer self.lock.Unlock() |