consensus/clique, internal/web3ext: support hash based API queries (#14321)

* consensus/clique, internal/web3ext: support hash based API queries

* consensus/clique: make RPC return types public
This commit is contained in:
Péter Szilágyi
2017-04-12 15:37:10 +03:00
committed by GitHub
parent 050ceff1ae
commit 6b7ae4e751
6 changed files with 66 additions and 32 deletions

View File

@ -349,16 +349,16 @@ func (c *Clique) verifyCascadingFields(chain consensus.ChainReader, header *type
}
// snapshot retrieves the authorization snapshot at a given point in time.
func (c *Clique) snapshot(chain consensus.ChainReader, number uint64, hash common.Hash, parents []*types.Header) (*snapshot, error) {
func (c *Clique) snapshot(chain consensus.ChainReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) {
// Search for a snapshot in memory or on disk for checkpoints
var (
headers []*types.Header
snap *snapshot
snap *Snapshot
)
for snap == nil {
// If an in-memory snapshot was found, use that
if s, ok := c.recents.Get(hash); ok {
snap = s.(*snapshot)
snap = s.(*Snapshot)
break
}
// If an on-disk checkpoint snapshot can be found, use that