mirror of
https://github.com/lightninglabs/pool.git
synced 2026-08-20 13:27:51 +02:00
rpcserver: call AbandonCanceledChannels for replaced batch
This commit is contained in:
parent
5a8825b8b4
commit
de2b86bd28
1 changed files with 18 additions and 10 deletions
28
rpcserver.go
28
rpcserver.go
|
|
@ -375,24 +375,32 @@ func (s *rpcServer) handleServerMessage(rpcMsg *poolrpc.ServerAuctionMessage) er
|
|||
// batch needs adjustment. Clear all previous shims.
|
||||
if s.orderManager.HasPendingBatch() {
|
||||
pendingBatch := s.orderManager.PendingBatch()
|
||||
orderFetcher := s.server.db.GetOrder
|
||||
err := pendingBatch.CancelPendingFundingShims(
|
||||
s.lndClient,
|
||||
func(o order.Nonce) (order.Order, error) {
|
||||
return s.server.db.GetOrder(o)
|
||||
},
|
||||
s.lndClient, orderFetcher,
|
||||
)
|
||||
if err != nil {
|
||||
// We can't accept the batch, something went
|
||||
// wrong.
|
||||
// CancelPendingFundingShims only returns hard
|
||||
// errors that justify us rejecting the batch.
|
||||
rpcLog.Errorf("Error clearing previous batch: "+
|
||||
"%v", err)
|
||||
return s.sendRejectBatch(batch, err)
|
||||
}
|
||||
|
||||
// TODO(guggero): Also abandon any channels that might
|
||||
// still be pending from a previous round of the same
|
||||
// batch or a previous batch that we didn't make it into
|
||||
// the final round.
|
||||
// Also abandon any channels that might still be pending
|
||||
// from a previous round of the same batch or a previous
|
||||
// batch that we didn't make it into the final round.
|
||||
err = pendingBatch.AbandonCanceledChannels(
|
||||
s.lndServices.WalletKit, s.lndClient,
|
||||
orderFetcher,
|
||||
)
|
||||
if err != nil {
|
||||
// AbandonCanceledChannels only returns hard
|
||||
// errors that justify us rejecting the batch.
|
||||
rpcLog.Errorf("Error abandoning channels from "+
|
||||
"last batch: %v", err)
|
||||
return s.sendRejectBatch(batch, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Do an in-depth verification of the batch.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue