les/checkpointoracle: move oracle into its own package (#20508)

* les: move the checkpoint oracle into its own package

It's first step of refactor LES package. LES package
basically can be divided into LES client and LES server.
However both sides will use checkpoint package for
status retrieval and verification. So this PR moves
checkpoint oracle into a separate package

* les: address comments
This commit is contained in:
Igor Mandrigin 2020-01-29 15:48:32 +02:00 committed by Igor Mandrigin
parent d17526e43d
commit 49621dc4d1

View File

@ -29,8 +29,9 @@ import (
"github.com/ledgerwatch/turbo-geth/core/types"
)
// CheckpointOracle is a Go wrapper around an on-chain light client checkpoint oracle.
// CheckpointOracle is a Go wrapper around an on-chain checkpoint oracle contract.
type CheckpointOracle struct {
address common.Address
contract *contract.CheckpointOracle
}
@ -40,7 +41,12 @@ func NewCheckpointOracle(contractAddr common.Address, backend bind.ContractBacke
if err != nil {
return nil, err
}
return &CheckpointOracle{contract: c}, nil
return &CheckpointOracle{address: contractAddr, contract: c}, nil
}
// ContractAddr returns the address of contract.
func (oracle *CheckpointOracle) ContractAddr() common.Address {
return oracle.address
}
// Contract returns the underlying contract instance.