Merge pull request #8961 from yyforyongyu/fix-leaseoutput

Improve the performace of `LeaseOutput`
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2024-08-21 16:31:26 -07:00
commit cc9e2b783e
20 files changed
+100 -87

No files matched your search

+2 -2
View File
@@ -179,7 +179,7 @@ type OutputLeaser interface {
// LeaseOutput leases a target output, rendering it unusable for coin
// selection.
LeaseOutput(i wtxmgr.LockID, o wire.OutPoint, d time.Duration) (
time.Time, []byte, btcutil.Amount, error)
time.Time, error)
// ReleaseOutput releases a target output, allowing it to be used for
// coin selection once again.
@@ -284,7 +284,7 @@ func CraftSweepAllTx(feeRate, maxFeeRate chainfee.SatPerKWeight,
log.Tracef("[WithCoinSelectLock] leasing utxo: %v",
utxo.OutPoint)
_, _, _, err = outputLeaser.LeaseOutput(
_, err = outputLeaser.LeaseOutput(
chanfunding.LndInternalLockID, utxo.OutPoint,
chanfunding.DefaultLockDuration,
)
+2 -2
View File
@@ -199,11 +199,11 @@ func newMockOutputLeaser() *mockOutputLeaser {
}
func (m *mockOutputLeaser) LeaseOutput(_ wtxmgr.LockID, o wire.OutPoint,
t time.Duration) (time.Time, []byte, btcutil.Amount, error) {
t time.Duration) (time.Time, error) {
m.leasedOutputs[o] = struct{}{}
return time.Now().Add(t), nil, 0, nil
return time.Now().Add(t), nil
}
func (m *mockOutputLeaser) ReleaseOutput(_ wtxmgr.LockID,