contractcourt+server: make IncubateOutputs take broadcastHeight

This commit is contained in:
Johan T. Halseth 2018-09-05 15:43:01 +02:00
parent 6d0deed885
commit 3a67fe2552
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
4 changed files with 12 additions and 5 deletions

View File

@ -105,7 +105,7 @@ type ChainArbitratorConfig struct {
// absolute/relative item block.
IncubateOutputs func(wire.OutPoint, *lnwallet.CommitOutputResolution,
*lnwallet.OutgoingHtlcResolution,
*lnwallet.IncomingHtlcResolution) error
*lnwallet.IncomingHtlcResolution, uint32) error
// PreimageDB is a global store of all known pre-images. We'll use this
// to decide if we should broadcast a commitment transaction to claim

View File

@ -648,7 +648,7 @@ func (c *ChannelArbitrator) stateStep(triggerHeight uint32,
err = c.cfg.IncubateOutputs(
c.cfg.ChanPoint, commitRes,
nil, nil,
nil, nil, triggerHeight,
)
if err != nil {
// TODO(roasbeef): check for AlreadyExists errors

View File

@ -152,7 +152,10 @@ func (h *htlcTimeoutResolver) Resolve() (ContractResolver, error) {
log.Tracef("%T(%v): incubating htlc output", h,
h.htlcResolution.ClaimOutpoint)
err := h.IncubateOutputs(h.ChanPoint, nil, &h.htlcResolution, nil)
err := h.IncubateOutputs(
h.ChanPoint, nil, &h.htlcResolution, nil,
h.broadcastHeight,
)
if err != nil {
return nil, err
}
@ -568,7 +571,10 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) {
log.Infof("%T(%x): incubating incoming htlc output",
h, h.payHash[:])
err := h.IncubateOutputs(h.ChanPoint, nil, nil, &h.htlcResolution)
err := h.IncubateOutputs(
h.ChanPoint, nil, nil, &h.htlcResolution,
h.broadcastHeight,
)
if err != nil {
return nil, err
}

View File

@ -628,7 +628,8 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl,
IncubateOutputs: func(chanPoint wire.OutPoint,
commitRes *lnwallet.CommitOutputResolution,
outHtlcRes *lnwallet.OutgoingHtlcResolution,
inHtlcRes *lnwallet.IncomingHtlcResolution) error {
inHtlcRes *lnwallet.IncomingHtlcResolution,
broadcastHeight uint32) error {
var (
inRes []lnwallet.IncomingHtlcResolution