diff options
author | Zsolt Felfoldi <zsfelfoldi@gmail.com> | 2016-12-10 13:50:36 +0800 |
---|---|---|
committer | Zsolt Felfoldi <zsfelfoldi@gmail.com> | 2016-12-10 16:53:25 +0800 |
commit | f12f8a6c14dbaf6e6531cea1b0cf169b851e1894 (patch) | |
tree | 41f0d7dd9f5fe21cbb8615a59cc08b9594f83770 /light/odr.go | |
parent | c57c54ce96628aeb6345776310123a80593f0143 (diff) | |
download | dexon-f12f8a6c14dbaf6e6531cea1b0cf169b851e1894.tar dexon-f12f8a6c14dbaf6e6531cea1b0cf169b851e1894.tar.gz dexon-f12f8a6c14dbaf6e6531cea1b0cf169b851e1894.tar.bz2 dexon-f12f8a6c14dbaf6e6531cea1b0cf169b851e1894.tar.lz dexon-f12f8a6c14dbaf6e6531cea1b0cf169b851e1894.tar.xz dexon-f12f8a6c14dbaf6e6531cea1b0cf169b851e1894.tar.zst dexon-f12f8a6c14dbaf6e6531cea1b0cf169b851e1894.zip |
les, light: add block availability check for ODR requests
Diffstat (limited to 'light/odr.go')
-rw-r--r-- | light/odr.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/light/odr.go b/light/odr.go index 679569bf9..4f6ef6b9e 100644 --- a/light/odr.go +++ b/light/odr.go @@ -48,6 +48,7 @@ type OdrRequest interface { // TrieID identifies a state or account storage trie type TrieID struct { BlockHash, Root common.Hash + BlockNumber uint64 AccKey []byte } @@ -55,9 +56,10 @@ type TrieID struct { // header. func StateTrieID(header *types.Header) *TrieID { return &TrieID{ - BlockHash: header.Hash(), - AccKey: nil, - Root: header.Root, + BlockHash: header.Hash(), + BlockNumber: header.Number.Uint64(), + AccKey: nil, + Root: header.Root, } } @@ -66,9 +68,10 @@ func StateTrieID(header *types.Header) *TrieID { // checking Merkle proofs. func StorageTrieID(state *TrieID, addr common.Address, root common.Hash) *TrieID { return &TrieID{ - BlockHash: state.BlockHash, - AccKey: crypto.Keccak256(addr[:]), - Root: root, + BlockHash: state.BlockHash, + BlockNumber: state.BlockNumber, + AccKey: crypto.Keccak256(addr[:]), + Root: root, } } |