mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 13:42:49 +02:00
multi: add reset closure to kvdb.View
This commit adds a reset() closure to the kvdb.View function which will be called before each retry (including the first) of the view transaction. The reset() closure can be used to reset external state (eg slices or maps) where the view closure puts intermediate results.
This commit is contained in:
@@ -197,6 +197,8 @@ func (store *networkResultStore) subscribeResult(paymentID uint64) (
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}, func() {
|
||||
result = nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -230,6 +232,8 @@ func (store *networkResultStore) getResult(pid uint64) (
|
||||
var err error
|
||||
result, err = fetchResult(tx, pid)
|
||||
return err
|
||||
}, func() {
|
||||
result = nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user