forked from relayooor/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix issue with geth not shutting down (ethereum#97) * Add eth_callBundle rpc method (ethereum#14) * flashbots: add eth_estimateGasBundle (ethereum#102) * feat(ethash): flashbots_getWork RPC with profit (ethereum#106) * Calculate megabundle as soon as it's received (ethereum#112) * Add v0.5 specification link (ethereum#118)
- Loading branch information
Showing
22 changed files
with
518 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package ethash | ||
|
||
import "errors" | ||
|
||
// FlashbotsAPI exposes Flashbots related methods for the RPC interface. | ||
type FlashbotsAPI struct { | ||
ethash *Ethash | ||
} | ||
|
||
// GetWork returns a work package for external miner. | ||
// | ||
// The work package consists of 5 strings: | ||
// result[0] - 32 bytes hex encoded current block header pow-hash | ||
// result[1] - 32 bytes hex encoded seed hash used for DAG | ||
// result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty | ||
// result[3] - hex encoded block number | ||
// result[4] - hex encoded profit generated from this block | ||
func (api *FlashbotsAPI) GetWork() ([5]string, error) { | ||
if api.ethash.remote == nil { | ||
return [5]string{}, errors.New("not supported") | ||
} | ||
|
||
var ( | ||
workCh = make(chan [5]string, 1) | ||
errc = make(chan error, 1) | ||
) | ||
select { | ||
case api.ethash.remote.fetchWorkCh <- &sealWork{errc: errc, res: workCh}: | ||
case <-api.ethash.remote.exitCh: | ||
return [5]string{}, errEthashStopped | ||
} | ||
select { | ||
case work := <-workCh: | ||
return work, nil | ||
case err := <-errc: | ||
return [5]string{}, err | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.