eth/downloader/downloader_test.go¶
| Type | MOD |
| Upstream Lines | 738 |
| Changed | +7 -0 |
Adapt downloader tests for PoW compatibility
diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go
index e6c477cd3..529dc6d7e 100644
--- a/eth/downloader/downloader_test.go
+++ b/eth/downloader/downloader_test.go
@@ -128,6 +128,13 @@ type downloadTesterPeer struct {
dropped chan error // signaled when res.Done receives an error
}
+// Head constructs a function to retrieve a peer's current head hash
+// and total difficulty.
+func (dlp *downloadTesterPeer) Head() (common.Hash, *big.Int) {
+ head := dlp.chain.CurrentBlock()
+ return head.Hash(), dlp.chain.GetTd(head.Hash(), head.Number.Uint64())
+}
+
func unmarshalRlpHeaders(rlpdata []rlp.RawValue) []*types.Header {
var headers = make([]*types.Header, len(rlpdata))
for i, data := range rlpdata {