mirror of
https://github.com/lightninglabs/pool.git
synced 2026-08-20 13:27:51 +02:00
auctioneer+server: send user agent to auctioneer
Send the static user agent plus the dynamic initiator string (if provided) to the auctioneer in the InitAccount and SubmitOrder RPCs.
This commit is contained in:
parent
76838927c8
commit
e245576d70
2 changed files with 11 additions and 1 deletions
|
|
@ -93,6 +93,10 @@ type Config struct {
|
|||
// BatchCleaner provides functionality to clean up the state of a
|
||||
// trader's pending batch.
|
||||
BatchCleaner BatchCleaner
|
||||
|
||||
// GenUserAgent is a function that generates a complete user agent
|
||||
// string given the incoming request context.
|
||||
GenUserAgent func(context.Context) string
|
||||
}
|
||||
|
||||
// Client performs the client side part of auctions. This interface exists to be
|
||||
|
|
@ -287,6 +291,7 @@ func (c *Client) InitAccount(ctx context.Context, account *account.Account) erro
|
|||
AccountValue: uint64(account.Value),
|
||||
AccountExpiry: account.Expiry,
|
||||
TraderKey: account.TraderKey.PubKey.SerializeCompressed(),
|
||||
UserAgent: c.cfg.GenUserAgent(ctx),
|
||||
},
|
||||
)
|
||||
return err
|
||||
|
|
@ -355,7 +360,9 @@ func (c *Client) SubmitOrder(ctx context.Context, o order.Order,
|
|||
|
||||
// Prepare everything that is common to both ask and bid orders.
|
||||
nonce := o.Nonce()
|
||||
rpcRequest := &auctioneerrpc.ServerSubmitOrderRequest{}
|
||||
rpcRequest := &auctioneerrpc.ServerSubmitOrderRequest{
|
||||
UserAgent: c.cfg.GenUserAgent(ctx),
|
||||
}
|
||||
nodeAddrs := make([]*auctioneerrpc.NodeAddress, 0, len(serverParams.Addrs))
|
||||
for _, addr := range serverParams.Addrs {
|
||||
nodeAddrs = append(nodeAddrs, &auctioneerrpc.NodeAddress{
|
||||
|
|
|
|||
|
|
@ -466,6 +466,9 @@ func (s *Server) setupClient() error {
|
|||
MaxBackoff: s.cfg.MaxBackoff,
|
||||
BatchSource: s.db,
|
||||
BatchCleaner: s.fundingManager,
|
||||
GenUserAgent: func(ctx context.Context) string {
|
||||
return UserAgent(InitiatorFromContext(ctx))
|
||||
},
|
||||
}
|
||||
s.AuctioneerClient, err = auctioneer.NewClient(clientCfg)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue