aboutsummaryrefslogtreecommitdiffstats
path: root/light/odr.go
diff options
context:
space:
mode:
Diffstat (limited to 'light/odr.go')
-rw-r--r--light/odr.go22
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