vspd: Rename blockConnected to update.
The name blockConnected is not very accurate as this function is also called when vspd is initializing. It doesnt depend on a block having been connected at all, it can be called at any time.
This commit is contained in:
parent
841ac77890
commit
69b27ff1e6
@ -80,9 +80,9 @@ func (v *Vspd) Run(ctx context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the block connected handler now to catch up with any blocks mined
|
// Run the update function now to catch up with any blocks mined while vspd
|
||||||
// while vspd was shut down.
|
// was shut down.
|
||||||
v.blockConnected(ctx)
|
v.update(ctx)
|
||||||
|
|
||||||
// Stop if shutdown requested.
|
// Stop if shutdown requested.
|
||||||
if ctx.Err() != nil {
|
if ctx.Err() != nil {
|
||||||
@ -117,10 +117,11 @@ func (v *Vspd) Run(ctx context.Context) {
|
|||||||
v.log.Errorf("dcrd connect error: %v", err)
|
v.log.Errorf("dcrd connect error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle blockconnected notifications from dcrd.
|
// Run the update function every time a block connected notification is
|
||||||
|
// received from dcrd.
|
||||||
case header := <-v.blockNotifChan:
|
case header := <-v.blockNotifChan:
|
||||||
v.log.Debugf("Block notification %d (%s)", header.Height, header.BlockHash().String())
|
v.log.Debugf("Block notification %d (%s)", header.Height, header.BlockHash().String())
|
||||||
v.blockConnected(ctx)
|
v.update(ctx)
|
||||||
|
|
||||||
// Handle shutdown request.
|
// Handle shutdown request.
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
@ -246,10 +247,10 @@ func (v *Vspd) checkRevoked(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// blockConnected is called once when vspd starts up, and once each time a
|
// update is called once when vspd starts up, and once each time a
|
||||||
// blockconnected notification is received from dcrd.
|
// blockconnected notification is received from dcrd.
|
||||||
func (v *Vspd) blockConnected(ctx context.Context) {
|
func (v *Vspd) update(ctx context.Context) {
|
||||||
const funcName = "blockConnected"
|
const funcName = "update"
|
||||||
|
|
||||||
dcrdClient, _, err := v.dcrd.Client()
|
dcrdClient, _, err := v.dcrd.Client()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user