From 81778664a723894ffb3653bc97f26fc92f71d953 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Fri, 27 Jul 2018 02:20:05 -0700 Subject: [PATCH] channeldb/channel: expose AckAddHtlc and AckSettleFail --- channeldb/channel.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/channeldb/channel.go b/channeldb/channel.go index 740d23ea..d0a28821 100644 --- a/channeldb/channel.go +++ b/channeldb/channel.go @@ -1597,6 +1597,31 @@ func (c *OpenChannel) LoadFwdPkgs() ([]*FwdPkg, error) { return fwdPkgs, nil } +// AckAddHtlcs updates the AckAddFilter containing any of the provided AddRefs +// indicating that a response to this Add has been committed to the remote party. +// Doing so will prevent these Add HTLCs from being reforwarded internally. +func (c *OpenChannel) AckAddHtlcs(addRefs ...AddRef) error { + c.Lock() + defer c.Unlock() + + return c.Db.Update(func(tx *bolt.Tx) error { + return c.Packager.AckAddHtlcs(tx, addRefs...) + }) +} + +// AckSettleFails updates the SettleFailFilter containing any of the provided +// SettleFailRefs, indicating that the response has been delivered to the +// incoming link, corresponding to a particular AddRef. Doing so will prevent +// the responses from being retransmitted internally. +func (c *OpenChannel) AckSettleFails(settleFailRefs ...SettleFailRef) error { + c.Lock() + defer c.Unlock() + + return c.Db.Update(func(tx *bolt.Tx) error { + return c.Packager.AckSettleFails(tx, settleFailRefs...) + }) +} + // SetFwdFilter atomically sets the forwarding filter for the forwarding package // identified by `height`. func (c *OpenChannel) SetFwdFilter(height uint64, fwdFilter *PkgFilter) error {