console: fix admin.sleepBlocks (#21629)

pull/21699/head
Hanjiang Yu 4 years ago committed by GitHub
parent 66c3eb2f1a
commit 32341f88e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      console/bridge.go

@ -353,14 +353,14 @@ func (b *bridge) SleepBlocks(call jsre.Call) (goja.Value, error) {
} }
// Poll the current block number until either it or a timeout is reached. // Poll the current block number until either it or a timeout is reached.
var ( deadline := time.Now().Add(time.Duration(sleep) * time.Second)
deadline = time.Now().Add(time.Duration(sleep) * time.Second) var lastNumber hexutil.Uint64
lastNumber = ^hexutil.Uint64(0) if err := b.client.Call(&lastNumber, "eth_blockNumber"); err != nil {
) return nil, err
}
for time.Now().Before(deadline) { for time.Now().Before(deadline) {
var number hexutil.Uint64 var number hexutil.Uint64
err := b.client.Call(&number, "eth_blockNumber") if err := b.client.Call(&number, "eth_blockNumber"); err != nil {
if err != nil {
return nil, err return nil, err
} }
if number != lastNumber { if number != lastNumber {

Loading…
Cancel
Save