From 42aec3fc8fb4c92e4bde1706a2c1ec66bb64aead Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 1 May 2021 16:28:06 -0700 Subject: [PATCH] rpc: include order nonce in SidecarTicket We add the order nonce as if automated negotiation was used, then the order nonce (when it actually is submitted and its state) can be used to track the ongoing sidecar ticket negotiation. --- rpcserver.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rpcserver.go b/rpcserver.go index 769b89b..efe3819 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -2324,6 +2324,17 @@ func (s *rpcServer) OfferSidecar(ctx context.Context, return nil, err } + var nonce order.Nonce + if bid != nil { + nonce = bid.Nonce() + } + + // If the bid has already been specified, then we can go ahead and set + // it within the ticket. + ticket.Order = &sidecar.Order{ + BidNonce: nonce, + } + // If the ticket has requested automated negotiation, then we'll hand // it off to the coordinate tor now. if ticket.Offer.Auto { @@ -2340,7 +2351,9 @@ func (s *rpcServer) OfferSidecar(ctx context.Context, if err != nil { return nil, err } - return &poolrpc.SidecarTicket{Ticket: ticketStr}, nil + return &poolrpc.SidecarTicket{ + Ticket: ticketStr, + }, nil } // RegisterSidecar is step 2/4 of the sidecar negotiation between the provider