Skip to content

Commit

Permalink
miner: address comment from martin
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 committed Oct 4, 2022
1 parent 55d31bb commit b014d29
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions miner/payload_building.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@ type Payload struct {
empty *types.Block
full *types.Block
stop chan struct{}
lock *sync.RWMutex
lock *sync.Mutex
cond *sync.Cond
}

// newPayload initializes the payload object.
func newPayload() *Payload {
lock := new(sync.RWMutex)
func newPayload(empty *types.Block) *Payload {
lock := new(sync.Mutex)
return &Payload{
stop: make(chan struct{}),
lock: lock,
cond: sync.NewCond(lock),
empty: empty,
stop: make(chan struct{}),
lock: lock,
cond: sync.NewCond(lock),
}
}

Expand Down Expand Up @@ -125,8 +126,7 @@ func (w *worker) buildPayload(args *BuildPayloadArgs) (*Payload, error) {
return nil, err
}
// Construct a payload object for return.
payload := newPayload()
payload.empty = empty
payload := newPayload(empty)

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

0 comments on commit b014d29

Please sign in to comment.