htlcswitch+channeldb: single tx for removing fwdpkgs

This commit changes RemoveFwdPkg to RemoveFwdPkgs so that a single
tx is used instead of N where N is the number of fwd pkgs to remove.
This commit is contained in:
eugene
2020-08-19 10:52:44 -04:00
parent e4764a67cc
commit 62e19185f1
3 changed files with 17 additions and 9 deletions

View File

@@ -776,7 +776,7 @@ func (l *channelLink) resolveFwdPkg(fwdPkg *channeldb.FwdPkg) error {
l.log.Debugf("removing completed fwd pkg for height=%d",
fwdPkg.Height)
err := l.channel.RemoveFwdPkg(fwdPkg.Height)
err := l.channel.RemoveFwdPkgs(fwdPkg.Height)
if err != nil {
l.log.Errorf("unable to remove fwd pkg for height=%d: "+
"%v", fwdPkg.Height, err)
@@ -859,7 +859,7 @@ func (l *channelLink) fwdPkgGarbager() {
continue
}
err = l.channel.RemoveFwdPkg(fwdPkg.Height)
err = l.channel.RemoveFwdPkgs(fwdPkg.Height)
if err != nil {
l.log.Warnf("unable to remove fwd pkg "+
"for height=%d: %v",