Skip to content

Commit

Permalink
Enable future blocks and turn off V5 discovery (ethereum#35)
Browse files Browse the repository at this point in the history
* Set V5 discover on mobile to false and allow future blocks

* new geth android build
  • Loading branch information
cmcewen authored Sep 7, 2018
1 parent b58db41 commit b1b3665
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Binary file modified build/bin/geth.aar
Binary file not shown.
4 changes: 3 additions & 1 deletion consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ var (

diffInTurn = big.NewInt(2) // Block difficulty for in-turn signatures
diffNoTurn = big.NewInt(1) // Block difficulty for out-of-turn signatures

allowedFutureBlockTime = 5 * time.Second // Max time from current time allowed for blocks, before they're considered future blocks
)

// Various error messages to mark blocks invalid. These should be private to
Expand Down Expand Up @@ -294,7 +296,7 @@ func (c *Clique) verifyHeader(chain consensus.ChainReader, header *types.Header,
number := header.Number.Uint64()

// Don't waste time checking blocks from the future
if header.Time.Cmp(big.NewInt(time.Now().Unix())) > 0 {
if header.Time.Cmp(big.NewInt(time.Now().Add(allowedFutureBlockTime).Unix())) > 0 {
return consensus.ErrFutureBlock
}
// Checkpoint blocks need to enforce zero proposed signer
Expand Down
2 changes: 1 addition & 1 deletion mobile/geth.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) {
IPCPath: "geth.ipc",
P2P: p2p.Config{
NoDiscovery: true,
DiscoveryV5: true,
DiscoveryV5: false,
BootstrapNodesV5: config.BootstrapNodes.nodes,
ListenAddr: ":0",
NAT: nat.Any(),
Expand Down

0 comments on commit b1b3665

Please sign in to comment.