mirror of
https://github.com/lightninglabs/pool.git
synced 2026-08-20 13:27:51 +02:00
parent
c9802b0cc1
commit
a28fa78813
1 changed files with 13 additions and 0 deletions
13
rpcserver.go
13
rpcserver.go
|
|
@ -1423,10 +1423,23 @@ func (s *rpcServer) CancelOrder(ctx context.Context,
|
|||
|
||||
rpcLog.Infof("Cancelling order_nonce=%v", nonce)
|
||||
|
||||
// We cancel an order in two phases. First, we'll cancel the order on
|
||||
// the server-side.
|
||||
err := s.auctioneer.CancelOrder(ctx, nonce)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Now that we've cancelled things on the server-side, we'll update our
|
||||
// local state to reflect this change in the order. If we crash here,
|
||||
// then we'll sync up the order state once we restart again.
|
||||
err = s.server.db.UpdateOrder(
|
||||
nonce, order.StateModifier(order.StateCanceled),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &clmrpc.CancelOrderResponse{}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue