utxonursery+chanbackup: fix range loop binding bugs
This commit is contained in:
parent
27ae22fa6c
commit
17ab813dcf
@ -230,10 +230,10 @@ func (s *SubSwapper) backupUpdater() {
|
|||||||
|
|
||||||
// For all closed channels, we'll remove the prior
|
// For all closed channels, we'll remove the prior
|
||||||
// backup state.
|
// backup state.
|
||||||
for _, closedChan := range chanUpdate.ClosedChans {
|
for i, closedChan := range chanUpdate.ClosedChans {
|
||||||
log.Debugf("Removing channel %v from backup "+
|
log.Debugf("Removing channel %v from backup "+
|
||||||
"state", newLogClosure(func() string {
|
"state", newLogClosure(func() string {
|
||||||
return closedChan.String()
|
return chanUpdate.ClosedChans[i].String()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
delete(s.backupState, closedChan)
|
delete(s.backupState, closedChan)
|
||||||
|
@ -42,7 +42,7 @@ type PeerConnector interface {
|
|||||||
func Recover(backups []Single, restorer ChannelRestorer,
|
func Recover(backups []Single, restorer ChannelRestorer,
|
||||||
peerConnector PeerConnector) error {
|
peerConnector PeerConnector) error {
|
||||||
|
|
||||||
for _, backup := range backups {
|
for i, backup := range backups {
|
||||||
log.Infof("Restoring ChannelPoint(%v) to disk: ",
|
log.Infof("Restoring ChannelPoint(%v) to disk: ",
|
||||||
backup.FundingOutpoint)
|
backup.FundingOutpoint)
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ func Recover(backups []Single, restorer ChannelRestorer,
|
|||||||
"restore ChannelPoint(%v)",
|
"restore ChannelPoint(%v)",
|
||||||
backup.RemoteNodePub.SerializeCompressed(),
|
backup.RemoteNodePub.SerializeCompressed(),
|
||||||
newLogClosure(func() string {
|
newLogClosure(func() string {
|
||||||
return spew.Sdump(backup.Addresses)
|
return spew.Sdump(backups[i].Addresses)
|
||||||
}), backup.FundingOutpoint)
|
}), backup.FundingOutpoint)
|
||||||
|
|
||||||
err = peerConnector.ConnectPeer(
|
err = peerConnector.ConnectPeer(
|
||||||
|
@ -455,9 +455,11 @@ func (u *utxoNursery) IncubateOutputs(chanPoint wire.OutPoint,
|
|||||||
// We'll examine all the baby outputs just inserted into the database,
|
// We'll examine all the baby outputs just inserted into the database,
|
||||||
// if the output has already expired, then we'll *immediately* sweep
|
// if the output has already expired, then we'll *immediately* sweep
|
||||||
// it. This may happen if the caller raced a block to call this method.
|
// it. This may happen if the caller raced a block to call this method.
|
||||||
for _, babyOutput := range babyOutputs {
|
for i, babyOutput := range babyOutputs {
|
||||||
if uint32(bestHeight) >= babyOutput.expiry {
|
if uint32(bestHeight) >= babyOutput.expiry {
|
||||||
err = u.sweepCribOutput(babyOutput.expiry, &babyOutput)
|
err = u.sweepCribOutput(
|
||||||
|
babyOutput.expiry, &babyOutputs[i],
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -468,9 +470,9 @@ func (u *utxoNursery) IncubateOutputs(chanPoint wire.OutPoint,
|
|||||||
// confirmation notification that will transition it to the
|
// confirmation notification that will transition it to the
|
||||||
// kindergarten bucket.
|
// kindergarten bucket.
|
||||||
if len(kidOutputs) != 0 {
|
if len(kidOutputs) != 0 {
|
||||||
for _, kidOutput := range kidOutputs {
|
for i := range kidOutputs {
|
||||||
err := u.registerPreschoolConf(
|
err := u.registerPreschoolConf(
|
||||||
&kidOutput, broadcastHeight,
|
&kidOutputs[i], broadcastHeight,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user