mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-01 02:51:37 +02:00
breacharbiter: properly account for second-level spends during breach remedy
In this commit, we address an un accounted for case during the breach remedy process. If the remote node actually went directly to the second layer during a channel breach attempt, then we wouldn’t properly be able to sweep with out justice transaction, as some HTLC inputs may actually be spent at that point. In order to address this case, we’ll now catch the transaction rejection, then check to see which input was spent, promote that to a second level spend, and repeat as necessary. At the end of this loop, any inputs which have been spent to the second level will have had the prevouts and witnesses updated. In order to perform this transition, we now also store the second level witness script in the database. This allow us to modify the sign desc with the proper input value, as well as witness script.
This commit is contained in:
8
mock.go
8
mock.go
@ -90,9 +90,11 @@ func (m *mockNotfier) RegisterConfirmationsNtfn(txid *chainhash.Hash, numConfs,
|
||||
Confirmed: m.confChannel,
|
||||
}, nil
|
||||
}
|
||||
func (m *mockNotfier) RegisterBlockEpochNtfn() (*chainntnfs.BlockEpochEvent,
|
||||
error) {
|
||||
return nil, nil
|
||||
func (m *mockNotfier) RegisterBlockEpochNtfn() (*chainntnfs.BlockEpochEvent, error) {
|
||||
return &chainntnfs.BlockEpochEvent{
|
||||
Epochs: make(chan *chainntnfs.BlockEpoch),
|
||||
Cancel: func() {},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *mockNotfier) Start() error {
|
||||
|
Reference in New Issue
Block a user