@@ -11,7 +11,6 @@ import (
1111 "time"
1212
1313 "github.com/btcsuite/btcd/btcec/v2"
14- "github.com/davecgh/go-spew/spew"
1514 "github.com/lightninglabs/lightning-node-connect/hashmailrpc"
1615 "github.com/lightninglabs/taproot-assets/asset"
1716 "github.com/lightninglabs/taproot-assets/fn"
@@ -58,11 +57,12 @@ type CourierHarness interface {
5857type Courier interface {
5958 // DeliverProof attempts to delivery a proof to the receiver, using the
6059 // information in the Addr type.
61- DeliverProof (context.Context , * AnnotatedProof ) error
60+ DeliverProof (context.Context , Recipient , * AnnotatedProof ) error
6261
6362 // ReceiveProof attempts to obtain a proof as identified by the passed
6463 // locator from the source encapsulated within the specified address.
65- ReceiveProof (context.Context , Locator ) (* AnnotatedProof , error )
64+ ReceiveProof (context.Context , Recipient ,
65+ Locator ) (* AnnotatedProof , error )
6666
6767 // SetSubscribers sets the set of subscribers that will be notified
6868 // of proof courier related events.
@@ -96,7 +96,7 @@ type CourierCfg struct {
9696type CourierDispatch interface {
9797 // NewCourier instantiates a new courier service handle given a service
9898 // URL address.
99- NewCourier (addr * url.URL , recipient Recipient ) (Courier , error )
99+ NewCourier (addr * url.URL ) (Courier , error )
100100}
101101
102102// URLDispatch is a proof courier dispatch that uses the courier address URL
@@ -114,9 +114,7 @@ func NewCourierDispatch(cfg *CourierCfg) *URLDispatch {
114114
115115// NewCourier instantiates a new courier service handle given a service URL
116116// address.
117- func (u * URLDispatch ) NewCourier (addr * url.URL ,
118- recipient Recipient ) (Courier , error ) {
119-
117+ func (u * URLDispatch ) NewCourier (addr * url.URL ) (Courier , error ) {
120118 subscribers := make (map [uint64 ]* fn.EventReceiver [fn.Event ])
121119
122120 // Create new courier addr based on URL scheme.
@@ -136,7 +134,6 @@ func (u *URLDispatch) NewCourier(addr *url.URL,
136134 return & HashMailCourier {
137135 cfg : u .cfg ,
138136 backoffHandle : backoffHandler ,
139- recipient : recipient ,
140137 mailbox : hashMailBox ,
141138 subscribers : subscribers ,
142139 }, nil
@@ -162,7 +159,6 @@ func (u *URLDispatch) NewCourier(addr *url.URL,
162159 client := unirpc .NewUniverseClient (conn )
163160
164161 return & UniverseRpcCourier {
165- recipient : recipient ,
166162 client : client ,
167163 backoffHandle : backoffHandler ,
168164 cfg : u .cfg ,
@@ -728,9 +724,8 @@ type HashMailCourier struct {
728724 // delivery.
729725 backoffHandle * BackoffHandler
730726
731- // recipient describes the recipient of the proof.
732- recipient Recipient
733-
727+ // mailbox is the mailbox service that the courier will use to interact
728+ // with the hashmail server.
734729 mailbox ProofMailbox
735730
736731 // subscribers is a map of components that want to be notified on new
@@ -747,14 +742,14 @@ type HashMailCourier struct {
747742//
748743// TODO(roasbeef): other delivery context as type param?
749744func (h * HashMailCourier ) DeliverProof (ctx context.Context ,
750- proof * AnnotatedProof ) error {
745+ recipient Recipient , proof * AnnotatedProof ) error {
751746
752747 log .Infof ("Attempting to deliver receiver proof for send of " +
753- "asset_id=%v, amt=%v" , h . recipient .AssetID , h . recipient .Amount )
748+ "asset_id=%v, amt=%v" , recipient .AssetID , recipient .Amount )
754749
755750 // Compute the stream IDs for the sender and receiver.
756- senderStreamID := deriveSenderStreamID (h . recipient )
757- receiverStreamID := deriveReceiverStreamID (h . recipient )
751+ senderStreamID := deriveSenderStreamID (recipient )
752+ receiverStreamID := deriveReceiverStreamID (recipient )
758753
759754 // Interact with the hashmail service using a backoff procedure to
760755 // ensure that we don't overwhelm the service with delivery attempts.
@@ -891,8 +886,7 @@ func (h *HashMailCourier) publishSubscriberEvent(event fn.Event) {
891886// Close closes the underlying connection to the hashmail server.
892887func (h * HashMailCourier ) Close () error {
893888 if err := h .mailbox .Close (); err != nil {
894- log .Warnf ("unable to close mailbox session, " +
895- "recipient=%v: %v" , err , spew .Sdump (h .recipient ))
889+ log .Warnf ("Unable to close mailbox session: %v" , err )
896890 return err
897891 }
898892
@@ -941,10 +935,10 @@ func NewBackoffWaitEvent(
941935
942936// ReceiveProof attempts to obtain a proof as identified by the passed locator
943937// from the source encapsulated within the specified address.
944- func (h * HashMailCourier ) ReceiveProof (ctx context.Context ,
938+ func (h * HashMailCourier ) ReceiveProof (ctx context.Context , recipient Recipient ,
945939 loc Locator ) (* AnnotatedProof , error ) {
946940
947- senderStreamID := deriveSenderStreamID (h . recipient )
941+ senderStreamID := deriveSenderStreamID (recipient )
948942 if err := h .mailbox .Init (ctx , senderStreamID ); err != nil {
949943 return nil , err
950944 }
@@ -960,7 +954,7 @@ func (h *HashMailCourier) ReceiveProof(ctx context.Context,
960954
961955 // Now that we've read the proof, we'll create our mailbox (which might
962956 // already exist) to send an ACK back to the sender.
963- receiverStreamID := deriveReceiverStreamID (h . recipient )
957+ receiverStreamID := deriveReceiverStreamID (recipient )
964958 log .Infof ("Sending ACK to sender via sid=%x" , receiverStreamID )
965959 if err := h .mailbox .Init (ctx , receiverStreamID ); err != nil {
966960 return nil , err
@@ -1001,9 +995,6 @@ type UniverseRpcCourierCfg struct {
1001995// UniverseRpcCourier is a universe RPC proof courier service handle. It
1002996// implements the Courier interface.
1003997type UniverseRpcCourier struct {
1004- // recipient describes the recipient of the proof.
1005- recipient Recipient
1006-
1007998 // client is the RPC client that the courier will use to interact with
1008999 // the universe RPC server.
10091000 client unirpc.UniverseClient
@@ -1030,7 +1021,7 @@ type UniverseRpcCourier struct {
10301021
10311022// DeliverProof attempts to delivery a proof file to the receiver.
10321023func (c * UniverseRpcCourier ) DeliverProof (ctx context.Context ,
1033- annotatedProof * AnnotatedProof ) error {
1024+ recipient Recipient , annotatedProof * AnnotatedProof ) error {
10341025
10351026 // Decode annotated proof into proof file.
10361027 proofFile := & File {}
@@ -1041,7 +1032,7 @@ func (c *UniverseRpcCourier) DeliverProof(ctx context.Context,
10411032
10421033 log .Infof ("Universe RPC proof courier attempting to deliver proof " +
10431034 "file (num_proofs=%d) for send event (asset_id=%v, amt=%v)" ,
1044- proofFile .NumProofs (), c . recipient .AssetID , c . recipient .Amount )
1035+ proofFile .NumProofs (), recipient .AssetID , recipient .Amount )
10451036
10461037 // Iterate over each proof in the proof file and submit to the courier
10471038 // service.
@@ -1136,7 +1127,7 @@ func (c *UniverseRpcCourier) DeliverProof(ctx context.Context,
11361127// ReceiveProof attempts to obtain a proof file from the courier service. The
11371128// final proof in the target proof file is identified by the given locator.
11381129func (c * UniverseRpcCourier ) ReceiveProof (ctx context.Context ,
1139- originLocator Locator ) (* AnnotatedProof , error ) {
1130+ _ Recipient , originLocator Locator ) (* AnnotatedProof , error ) {
11401131
11411132 fetchProof := func (ctx context.Context , loc Locator ) (Blob , error ) {
11421133 var groupKeyBytes []byte
0 commit comments