Skip to content

Commit

Permalink
utxonursery: pass broadcastHeight to registerPreschoolConf
Browse files Browse the repository at this point in the history
In this commit IncubateOutputs are given an extra parameter
broadcastHeight, which is passed from the server and used when called
registerPresschoolConf.

Earlier the utxonursery used the bestHeight as height hint in this case,
which would be wrong in the cases where we got outputs for incubation
which was confirmed below the best height.
  • Loading branch information
halseth committed Sep 20, 2018
1 parent 3a67fe2 commit 0a5f982
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions server.go
Expand Up @@ -644,6 +644,7 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl,

return s.utxoNursery.IncubateOutputs(
chanPoint, commitRes, outRes, inRes,
broadcastHeight,
)
},
PreimageDB: s.witnessBeacon,
Expand Down
7 changes: 5 additions & 2 deletions utxonursery.go
Expand Up @@ -343,7 +343,8 @@ func (u *utxoNursery) Stop() error {
func (u *utxoNursery) IncubateOutputs(chanPoint wire.OutPoint,
commitResolution *lnwallet.CommitOutputResolution,
outgoingHtlcs []lnwallet.OutgoingHtlcResolution,
incomingHtlcs []lnwallet.IncomingHtlcResolution) error {
incomingHtlcs []lnwallet.IncomingHtlcResolution,
broadcastHeight uint32) error {

numHtlcs := len(incomingHtlcs) + len(outgoingHtlcs)
var (
Expand Down Expand Up @@ -469,7 +470,9 @@ func (u *utxoNursery) IncubateOutputs(chanPoint wire.OutPoint,
// kindergarten bucket.
if len(kidOutputs) != 0 {
for _, kidOutput := range kidOutputs {
err := u.registerPreschoolConf(&kidOutput, u.bestHeight)
err := u.registerPreschoolConf(
&kidOutput, broadcastHeight,
)
if err != nil {
return err
}
Expand Down

0 comments on commit 0a5f982

Please sign in to comment.