Skip to content

Commit b014d29

Browse files
committed
miner: address comment from martin
1 parent 55d31bb commit b014d29

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

miner/payload_building.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,18 @@ type Payload struct {
4444
empty *types.Block
4545
full *types.Block
4646
stop chan struct{}
47-
lock *sync.RWMutex
47+
lock *sync.Mutex
4848
cond *sync.Cond
4949
}
5050

5151
// newPayload initializes the payload object.
52-
func newPayload() *Payload {
53-
lock := new(sync.RWMutex)
52+
func newPayload(empty *types.Block) *Payload {
53+
lock := new(sync.Mutex)
5454
return &Payload{
55-
stop: make(chan struct{}),
56-
lock: lock,
57-
cond: sync.NewCond(lock),
55+
empty: empty,
56+
stop: make(chan struct{}),
57+
lock: lock,
58+
cond: sync.NewCond(lock),
5859
}
5960
}
6061

@@ -125,8 +126,7 @@ func (w *worker) buildPayload(args *BuildPayloadArgs) (*Payload, error) {
125126
return nil, err
126127
}
127128
// Construct a payload object for return.
128-
payload := newPayload()
129-
payload.empty = empty
129+
payload := newPayload(empty)
130130

131131
// Spin up a routine for updating the payload in background. This strategy
132132
// can maximum the revenue for including transactions with highest fee.

0 commit comments

Comments
 (0)