mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-02 19:44:03 +02:00
lnd: cancel rebroadcasting a tx.
When abandoning a channel we make sure we cancel the rebroadcasting of the transaction.
This commit is contained in:
11
rpcserver.go
11
rpcserver.go
@ -2731,12 +2731,21 @@ func abandonChanFromGraph(chanGraph *channeldb.ChannelGraph,
|
|||||||
func (r *rpcServer) abandonChan(chanPoint *wire.OutPoint,
|
func (r *rpcServer) abandonChan(chanPoint *wire.OutPoint,
|
||||||
bestHeight uint32) error {
|
bestHeight uint32) error {
|
||||||
|
|
||||||
|
// Before we remove the channel we cancel the rebroadcasting of the
|
||||||
|
// transaction. If this transaction does not exist in the rebroadcast
|
||||||
|
// queue anymore it is a noop.
|
||||||
|
txid, err := chainhash.NewHash(chanPoint.Hash[:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
r.server.cc.Wallet.CancelRebroadcast(*txid)
|
||||||
|
|
||||||
// Abandoning a channel is a three-step process: remove from the open
|
// Abandoning a channel is a three-step process: remove from the open
|
||||||
// channel state, remove from the graph, remove from the contract
|
// channel state, remove from the graph, remove from the contract
|
||||||
// court. Between any step it's possible that the users restarts the
|
// court. Between any step it's possible that the users restarts the
|
||||||
// process all over again. As a result, each of the steps below are
|
// process all over again. As a result, each of the steps below are
|
||||||
// intended to be idempotent.
|
// intended to be idempotent.
|
||||||
err := r.server.chanStateDB.AbandonChannel(chanPoint, bestHeight)
|
err = r.server.chanStateDB.AbandonChannel(chanPoint, bestHeight)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user