multi: fix newly detected linter issues

This commit is contained in:
Oliver Gugger committed 2022-02-10 11:02:02 +01:00
1 parent 369627901f
commit ffee7d1bcf
30 files changed
+106 -118

No files matched your search

+2 -2
View File
@@ -487,8 +487,8 @@ func (c *commitSweepResolver) report() *ContractReport {
c.reportLock.Lock()
defer c.reportLock.Unlock()
copy := c.currentReport
return &copy
cpy := c.currentReport
return &cpy
}
// initReport initializes the pending channels report for this resolver.
+2 -2
View File
@@ -515,8 +515,8 @@ func (h *htlcSuccessResolver) report() *ContractReport {
h.reportLock.Lock()
defer h.reportLock.Unlock()
copy := h.currentReport
return &copy
cpy := h.currentReport
return &cpy
}
func (h *htlcSuccessResolver) initReport() {
+4 -4
View File
@@ -529,7 +529,7 @@ func (h *htlcTimeoutResolver) handleCommitSpend(
case h.htlcResolution.SignedTimeoutTx != nil:
log.Infof("%T(%v): waiting for nursery/sweeper to spend CSV "+
"delayed output", h, claimOutpoint)
sweep, err := waitForSpend(
sweepTx, err := waitForSpend(
&claimOutpoint,
h.htlcResolution.SweepSignDesc.Output.PkScript,
h.broadcastHeight, h.Notifier, h.quit,
@@ -539,7 +539,7 @@ func (h *htlcTimeoutResolver) handleCommitSpend(
}
// Update the spend txid to the hash of the sweep transaction.
spendTxID = sweep.SpenderTxHash
spendTxID = sweepTx.SpenderTxHash
// Once our sweep of the timeout tx has confirmed, we add a
// resolution for our timeoutTx tx first stage transaction.
@@ -603,8 +603,8 @@ func (h *htlcTimeoutResolver) report() *ContractReport {
h.reportLock.Lock()
defer h.reportLock.Unlock()
copy := h.currentReport
return &copy
cpy := h.currentReport
return &cpy
}
func (h *htlcTimeoutResolver) initReport() {
+1 -1
View File
@@ -1218,7 +1218,7 @@ func TestHtlcTimeoutSecondStageSweeperRemoteSpend(t *testing.T) {
// expect the resolver to re-subscribe to a
// spend, hence we must resend it.
if resumed {
fmt.Println("resumed")
t.Logf("resumed")
ctx.notifier.SpendChan <- &chainntnfs.SpendDetail{
SpendingTx: spendTx,
SpenderTxHash: &spendTxHash,
+13 -12
View File
@@ -1058,18 +1058,18 @@ func (ns *NurseryStore) createHeightBucket(tx kvdb.RwTx,
// store, using the provided block height. If the bucket does not exist, or any
// bucket along its path does not exist, a nil value is returned.
func (ns *NurseryStore) getHeightBucketPath(tx kvdb.RTx,
height uint32) (kvdb.RBucket, kvdb.RBucket, kvdb.RBucket) {
height uint32) (kvdb.RBucket, kvdb.RBucket) {
// Retrieve the existing chain bucket for this nursery store.
chainBucket := tx.ReadBucket(ns.pfxChainKey)
if chainBucket == nil {
return nil, nil, nil
return nil, nil
}
// Retrieve the existing channel index.
hghtIndex := chainBucket.NestedReadBucket(heightIndexKey)
if hghtIndex == nil {
return nil, nil, nil
return nil, nil
}
// Serialize the provided block height and return the bucket matching
@@ -1077,25 +1077,25 @@ func (ns *NurseryStore) getHeightBucketPath(tx kvdb.RTx,
var heightBytes [4]byte
byteOrder.PutUint32(heightBytes[:], height)
return chainBucket, hghtIndex, hghtIndex.NestedReadBucket(heightBytes[:])
return chainBucket, hghtIndex.NestedReadBucket(heightBytes[:])
}
// getHeightBucketPathWrite retrieves an existing height bucket from the nursery
// store, using the provided block height. If the bucket does not exist, or any
// bucket along its path does not exist, a nil value is returned.
func (ns *NurseryStore) getHeightBucketPathWrite(tx kvdb.RwTx,
height uint32) (kvdb.RwBucket, kvdb.RwBucket, kvdb.RwBucket) {
height uint32) (kvdb.RwBucket, kvdb.RwBucket) {
// Retrieve the existing chain bucket for this nursery store.
chainBucket := tx.ReadWriteBucket(ns.pfxChainKey)
if chainBucket == nil {
return nil, nil, nil
return nil, nil
}
// Retrieve the existing channel index.
hghtIndex := chainBucket.NestedReadWriteBucket(heightIndexKey)
if hghtIndex == nil {
return nil, nil, nil
return nil, nil
}
// Serialize the provided block height and return the bucket matching
@@ -1103,7 +1103,7 @@ func (ns *NurseryStore) getHeightBucketPathWrite(tx kvdb.RwTx,
var heightBytes [4]byte
byteOrder.PutUint32(heightBytes[:], height)
return chainBucket, hghtIndex, hghtIndex.NestedReadWriteBucket(
return hghtIndex, hghtIndex.NestedReadWriteBucket(
heightBytes[:],
)
}
@@ -1113,7 +1113,8 @@ func (ns *NurseryStore) getHeightBucketPathWrite(tx kvdb.RwTx,
// along its path does not exist, a nil value is returned.
func (ns *NurseryStore) getHeightBucket(tx kvdb.RTx,
height uint32) kvdb.RBucket {
_, _, hghtBucket := ns.getHeightBucketPath(tx, height)
_, hghtBucket := ns.getHeightBucketPath(tx, height)
return hghtBucket
}
@@ -1124,7 +1125,7 @@ func (ns *NurseryStore) getHeightBucket(tx kvdb.RTx,
func (ns *NurseryStore) getHeightBucketWrite(tx kvdb.RwTx,
height uint32) kvdb.RwBucket {
_, _, hghtBucket := ns.getHeightBucketPathWrite(tx, height)
_, hghtBucket := ns.getHeightBucketPathWrite(tx, height)
return hghtBucket
}
@@ -1190,7 +1191,7 @@ func (ns *NurseryStore) forEachHeightPrefix(tx kvdb.RTx, prefix []byte,
// Start by retrieving the height bucket corresponding to the provided
// block height.
chainBucket, _, hghtBucket := ns.getHeightBucketPath(tx, height)
chainBucket, hghtBucket := ns.getHeightBucketPath(tx, height)
if hghtBucket == nil {
return nil
}
@@ -1345,7 +1346,7 @@ func (ns *NurseryStore) removeOutputFromHeight(tx kvdb.RwTx, height uint32,
// this invocation successfully pruned the height bucket.
func (ns *NurseryStore) pruneHeight(tx kvdb.RwTx, height uint32) (bool, error) {
// Fetch the existing height index and height bucket.
_, hghtIndex, hghtBucket := ns.getHeightBucketPathWrite(tx, height)
hghtIndex, hghtBucket := ns.getHeightBucketPathWrite(tx, height)
if hghtBucket == nil {
return false, nil
}