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 /light/odr.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 'light/odr.go')
-rw-r--r-- | light/odr.go | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/light/odr.go b/light/odr.go index d1185e4e0..907712ede 100644 --- a/light/odr.go +++ b/light/odr.go @@ -122,19 +122,25 @@ func (req *BlockRequest) StoreResult(db ethdb.Database) { // ReceiptsRequest is the ODR request type for retrieving block bodies type ReceiptsRequest struct { OdrRequest - Hash common.Hash - Number uint64 - Receipts types.Receipts + Untrusted bool // Indicator whether the result retrieved is trusted or not + Hash common.Hash + Number uint64 + Header *types.Header + Receipts types.Receipts } // StoreResult stores the retrieved data in local database func (req *ReceiptsRequest) StoreResult(db ethdb.Database) { - rawdb.WriteReceipts(db, req.Hash, req.Number, req.Receipts) + if !req.Untrusted { + rawdb.WriteReceipts(db, req.Hash, req.Number, req.Receipts) + } } // ChtRequest is the ODR request type for state/storage trie entries type ChtRequest struct { OdrRequest + Untrusted bool // Indicator whether the result retrieved is trusted or not + PeerId string // The specified peer id from which to retrieve data. Config *IndexerConfig ChtNum, BlockNum uint64 ChtRoot common.Hash @@ -147,9 +153,11 @@ type ChtRequest struct { func (req *ChtRequest) StoreResult(db ethdb.Database) { hash, num := req.Header.Hash(), req.Header.Number.Uint64() - rawdb.WriteHeader(db, req.Header) - rawdb.WriteTd(db, hash, num, req.Td) - rawdb.WriteCanonicalHash(db, hash, num) + if !req.Untrusted { + rawdb.WriteHeader(db, req.Header) + rawdb.WriteTd(db, hash, num, req.Td) + rawdb.WriteCanonicalHash(db, hash, num) + } } // BloomRequest is the ODR request type for retrieving bloom filters from a CHT structure |