@@ -325,14 +325,16 @@ func handleGetInfoResponse(db firewalldb.PrivacyMapDB,
325325 flags session.PrivacyFlags ) func (ctx context.Context ,
326326 r * lnrpc.GetInfoResponse ) (proto.Message , error ) {
327327
328- return func (_ context.Context , r * lnrpc.GetInfoResponse ) (
328+ return func (ctx context.Context , r * lnrpc.GetInfoResponse ) (
329329 proto.Message , error ) {
330330
331331 // We hide the pubkey unless it is disabled.
332332 pseudoPubKey := r .IdentityPubkey
333333 if ! flags .Contains (session .ClearPubkeys ) {
334- err := db .Update (
335- func (tx firewalldb.PrivacyMapTx ) error {
334+ err := db .Update (ctx ,
335+ func (ctx context.Context ,
336+ tx firewalldb.PrivacyMapTx ) error {
337+
336338 var err error
337339 pseudoPubKey , err = firewalldb .HideString (
338340 tx , r .IdentityPubkey ,
@@ -377,14 +379,16 @@ func handleFwdHistoryResponse(db firewalldb.PrivacyMapDB,
377379 randIntn func (int ) (int , error )) func (ctx context.Context ,
378380 r * lnrpc.ForwardingHistoryResponse ) (proto.Message , error ) {
379381
380- return func (_ context.Context , r * lnrpc.ForwardingHistoryResponse ) (
382+ return func (ctx context.Context , r * lnrpc.ForwardingHistoryResponse ) (
381383 proto.Message , error ) {
382384
383385 fwdEvents := make (
384386 []* lnrpc.ForwardingEvent , len (r .ForwardingEvents ),
385387 )
386388
387- err := db .Update (func (tx firewalldb.PrivacyMapTx ) error {
389+ err := db .Update (ctx , func (ctx context.Context ,
390+ tx firewalldb.PrivacyMapTx ) error {
391+
388392 for i , fe := range r .ForwardingEvents {
389393 var err error
390394
@@ -487,7 +491,9 @@ func handleFeeReportResponse(db firewalldb.PrivacyMapDB,
487491
488492 chanFees := make ([]* lnrpc.ChannelFeeReport , len (r .ChannelFees ))
489493
490- err := db .Update (func (tx firewalldb.PrivacyMapTx ) error {
494+ err := db .Update (ctx , func (ctx context.Context ,
495+ tx firewalldb.PrivacyMapTx ) error {
496+
491497 var err error
492498
493499 for i , c := range r .ChannelFees {
@@ -550,7 +556,9 @@ func handleListChannelsRequest(db firewalldb.PrivacyMapDB,
550556 return r , nil
551557 }
552558
553- err := db .View (func (tx firewalldb.PrivacyMapTx ) error {
559+ err := db .View (ctx , func (ctx context.Context ,
560+ tx firewalldb.PrivacyMapTx ) error {
561+
554562 peer , err := firewalldb .RevealBytes (tx , r .Peer )
555563 if err != nil {
556564 return err
@@ -572,15 +580,17 @@ func handleListChannelsResponse(db firewalldb.PrivacyMapDB,
572580 randIntn func (int ) (int , error )) func (ctx context.Context ,
573581 r * lnrpc.ListChannelsResponse ) (proto.Message , error ) {
574582
575- return func (_ context.Context , r * lnrpc.ListChannelsResponse ) (
583+ return func (ctx context.Context , r * lnrpc.ListChannelsResponse ) (
576584 proto.Message , error ) {
577585
578586 hidePubkeys := ! flags .Contains (session .ClearPubkeys )
579587 hideChanIds := ! flags .Contains (session .ClearChanIDs )
580588
581589 channels := make ([]* lnrpc.Channel , len (r .Channels ))
582590
583- err := db .Update (func (tx firewalldb.PrivacyMapTx ) error {
591+ err := db .Update (ctx , func (ctx context.Context ,
592+ tx firewalldb.PrivacyMapTx ) error {
593+
584594 for i , c := range r .Channels {
585595 var err error
586596
@@ -745,7 +755,7 @@ func handleUpdatePolicyRequest(db firewalldb.PrivacyMapDB,
745755 flags session.PrivacyFlags ) func (ctx context.Context ,
746756 r * lnrpc.PolicyUpdateRequest ) (proto.Message , error ) {
747757
748- return func (_ context.Context , r * lnrpc.PolicyUpdateRequest ) (
758+ return func (ctx context.Context , r * lnrpc.PolicyUpdateRequest ) (
749759 proto.Message , error ) {
750760
751761 chanPoint := r .GetChanPoint ()
@@ -764,7 +774,9 @@ func handleUpdatePolicyRequest(db firewalldb.PrivacyMapDB,
764774 newTxid := txid .String ()
765775 newIndex := chanPoint .GetOutputIndex ()
766776 if ! flags .Contains (session .ClearChanIDs ) {
767- err = db .View (func (tx firewalldb.PrivacyMapTx ) error {
777+ err = db .View (ctx , func (ctx context.Context ,
778+ tx firewalldb.PrivacyMapTx ) error {
779+
768780 var err error
769781 newTxid , newIndex , err = firewalldb .RevealChanPoint (
770782 tx , newTxid , newIndex ,
@@ -793,7 +805,7 @@ func handleUpdatePolicyResponse(db firewalldb.PrivacyMapDB,
793805 flags session.PrivacyFlags ) func (ctx context.Context ,
794806 r * lnrpc.PolicyUpdateResponse ) (proto.Message , error ) {
795807
796- return func (_ context.Context , r * lnrpc.PolicyUpdateResponse ) (
808+ return func (ctx context.Context , r * lnrpc.PolicyUpdateResponse ) (
797809 proto.Message , error ) {
798810
799811 if flags .Contains (session .ClearChanIDs ) {
@@ -804,7 +816,9 @@ func handleUpdatePolicyResponse(db firewalldb.PrivacyMapDB,
804816 []* lnrpc.FailedUpdate , len (r .FailedUpdates ),
805817 )
806818
807- err := db .Update (func (tx firewalldb.PrivacyMapTx ) error {
819+ err := db .Update (ctx , func (ctx context.Context ,
820+ tx firewalldb.PrivacyMapTx ) error {
821+
808822 for i , u := range r .FailedUpdates {
809823 failedUpdates [i ] = & lnrpc.FailedUpdate {
810824 Reason : u .Reason ,
@@ -926,15 +940,17 @@ func handleClosedChannelsResponse(db firewalldb.PrivacyMapDB,
926940 randIntn func (int ) (int , error )) func (ctx context.Context ,
927941 r * lnrpc.ClosedChannelsResponse ) (proto.Message , error ) {
928942
929- return func (_ context.Context , r * lnrpc.ClosedChannelsResponse ) (
943+ return func (ctx context.Context , r * lnrpc.ClosedChannelsResponse ) (
930944 proto.Message , error ) {
931945
932946 closedChannels := make (
933947 []* lnrpc.ChannelCloseSummary ,
934948 len (r .Channels ),
935949 )
936950
937- err := db .Update (func (tx firewalldb.PrivacyMapTx ) error {
951+ err := db .Update (ctx , func (ctx context.Context ,
952+ tx firewalldb.PrivacyMapTx ) error {
953+
938954 for i , c := range r .Channels {
939955 var err error
940956
@@ -1117,7 +1133,7 @@ func handlePendingChannelsResponse(db firewalldb.PrivacyMapDB,
11171133 randIntn func (int ) (int , error )) func (ctx context.Context ,
11181134 r * lnrpc.PendingChannelsResponse ) (proto.Message , error ) {
11191135
1120- return func (_ context.Context , r * lnrpc.PendingChannelsResponse ) (
1136+ return func (ctx context.Context , r * lnrpc.PendingChannelsResponse ) (
11211137 proto.Message , error ) {
11221138
11231139 pendingOpens := make (
@@ -1140,7 +1156,9 @@ func handlePendingChannelsResponse(db firewalldb.PrivacyMapDB,
11401156 len (r .WaitingCloseChannels ),
11411157 )
11421158
1143- err := db .Update (func (tx firewalldb.PrivacyMapTx ) error {
1159+ err := db .Update (ctx , func (ctx context.Context ,
1160+ tx firewalldb.PrivacyMapTx ) error {
1161+
11441162 for i , c := range r .PendingOpenChannels {
11451163 var err error
11461164
@@ -1343,12 +1361,14 @@ func handleBatchOpenChannelRequest(db firewalldb.PrivacyMapDB,
13431361 flags session.PrivacyFlags ) func (ctx context.Context ,
13441362 r * lnrpc.BatchOpenChannelRequest ) (proto.Message , error ) {
13451363
1346- return func (_ context.Context , r * lnrpc.BatchOpenChannelRequest ) (
1364+ return func (ctx context.Context , r * lnrpc.BatchOpenChannelRequest ) (
13471365 proto.Message , error ) {
13481366
13491367 var reqs = make ([]* lnrpc.BatchOpenChannel , len (r .Channels ))
13501368
1351- err := db .View (func (tx firewalldb.PrivacyMapTx ) error {
1369+ err := db .View (ctx , func (ctx context.Context ,
1370+ tx firewalldb.PrivacyMapTx ) error {
1371+
13521372 for i , c := range r .Channels {
13531373 var err error
13541374
@@ -1414,12 +1434,14 @@ func handleBatchOpenChannelResponse(db firewalldb.PrivacyMapDB,
14141434 flags session.PrivacyFlags ) func (ctx context.Context ,
14151435 r * lnrpc.BatchOpenChannelResponse ) (proto.Message , error ) {
14161436
1417- return func (_ context.Context , r * lnrpc.BatchOpenChannelResponse ) (
1437+ return func (ctx context.Context , r * lnrpc.BatchOpenChannelResponse ) (
14181438 proto.Message , error ) {
14191439
14201440 resps := make ([]* lnrpc.PendingUpdate , len (r .PendingChannels ))
14211441
1422- err := db .Update (func (tx firewalldb.PrivacyMapTx ) error {
1442+ err := db .Update (ctx , func (ctx context.Context ,
1443+ tx firewalldb.PrivacyMapTx ) error {
1444+
14231445 for i , p := range r .PendingChannels {
14241446 var (
14251447 txIdBytes = p .Txid
@@ -1471,14 +1493,15 @@ func handleChannelOpenRequest(db firewalldb.PrivacyMapDB,
14711493 flags session.PrivacyFlags ) func (ctx context.Context ,
14721494 r * lnrpc.OpenChannelRequest ) (proto.Message , error ) {
14731495
1474- return func (_ context.Context , r * lnrpc.OpenChannelRequest ) (
1496+ return func (ctx context.Context , r * lnrpc.OpenChannelRequest ) (
14751497 proto.Message , error ) {
14761498
14771499 var nodePubkey []byte
14781500
1479- err := db .View (func (tx firewalldb. PrivacyMapTx ) error {
1480- var err error
1501+ err := db .View (ctx , func (ctx context. Context ,
1502+ tx firewalldb. PrivacyMapTx ) error {
14811503
1504+ var err error
14821505 // We use the byte slice representation of the
14831506 // pubkey and fall back to the hex string if present.
14841507 nodePubkey = r .NodePubkey
@@ -1548,15 +1571,17 @@ func handleChannelOpenResponse(db firewalldb.PrivacyMapDB,
15481571 flags session.PrivacyFlags ) func (ctx context.Context ,
15491572 r * lnrpc.ChannelPoint ) (proto.Message , error ) {
15501573
1551- return func (_ context.Context , r * lnrpc.ChannelPoint ) (
1574+ return func (ctx context.Context , r * lnrpc.ChannelPoint ) (
15521575 proto.Message , error ) {
15531576
15541577 var (
15551578 txid string
15561579 index uint32
15571580 )
15581581
1559- err := db .Update (func (tx firewalldb.PrivacyMapTx ) error {
1582+ err := db .Update (ctx , func (ctx context.Context ,
1583+ tx firewalldb.PrivacyMapTx ) error {
1584+
15601585 var err error
15611586
15621587 txid = r .GetFundingTxidStr ()
@@ -1622,12 +1647,14 @@ func handleConnectPeerRequest(db firewalldb.PrivacyMapDB,
16221647 flags session.PrivacyFlags ) func (ctx context.Context ,
16231648 r * lnrpc.ConnectPeerRequest ) (proto.Message , error ) {
16241649
1625- return func (_ context.Context , r * lnrpc.ConnectPeerRequest ) (
1650+ return func (ctx context.Context , r * lnrpc.ConnectPeerRequest ) (
16261651 proto.Message , error ) {
16271652
16281653 var addr * lnrpc.LightningAddress
16291654
1630- err := db .View (func (tx firewalldb.PrivacyMapTx ) error {
1655+ err := db .View (ctx , func (ctx context.Context ,
1656+ tx firewalldb.PrivacyMapTx ) error {
1657+
16311658 var err error
16321659
16331660 // Note, this only works if the pubkey alias was
0 commit comments