|
|
|
@ -175,10 +175,20 @@ func (w *worker) buildPayload(args *BuildPayloadArgs) (*Payload, error) { |
|
|
|
|
// Build the initial version with no transaction included. It should be fast
|
|
|
|
|
// enough to run. The empty payload can at least make sure there is something
|
|
|
|
|
// to deliver for not missing slot.
|
|
|
|
|
empty := w.getSealingBlock(args.Parent, args.Timestamp, args.FeeRecipient, args.Random, args.Withdrawals, true) |
|
|
|
|
emptyParams := &generateParams{ |
|
|
|
|
timestamp: args.Timestamp, |
|
|
|
|
forceTime: true, |
|
|
|
|
parentHash: args.Parent, |
|
|
|
|
coinbase: args.FeeRecipient, |
|
|
|
|
random: args.Random, |
|
|
|
|
withdrawals: args.Withdrawals, |
|
|
|
|
noTxs: true, |
|
|
|
|
} |
|
|
|
|
empty := w.getSealingBlock(emptyParams) |
|
|
|
|
if empty.err != nil { |
|
|
|
|
return nil, empty.err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Construct a payload object for return.
|
|
|
|
|
payload := newPayload(empty.block, args.Id()) |
|
|
|
|
|
|
|
|
@ -195,11 +205,21 @@ func (w *worker) buildPayload(args *BuildPayloadArgs) (*Payload, error) { |
|
|
|
|
// by the timestamp parameter.
|
|
|
|
|
endTimer := time.NewTimer(time.Second * 12) |
|
|
|
|
|
|
|
|
|
fullParams := &generateParams{ |
|
|
|
|
timestamp: args.Timestamp, |
|
|
|
|
forceTime: true, |
|
|
|
|
parentHash: args.Parent, |
|
|
|
|
coinbase: args.FeeRecipient, |
|
|
|
|
random: args.Random, |
|
|
|
|
withdrawals: args.Withdrawals, |
|
|
|
|
noTxs: false, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for { |
|
|
|
|
select { |
|
|
|
|
case <-timer.C: |
|
|
|
|
start := time.Now() |
|
|
|
|
r := w.getSealingBlock(args.Parent, args.Timestamp, args.FeeRecipient, args.Random, args.Withdrawals, false) |
|
|
|
|
r := w.getSealingBlock(fullParams) |
|
|
|
|
if r.err == nil { |
|
|
|
|
payload.update(r, time.Since(start)) |
|
|
|
|
} |
|
|
|
|