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 committed 2020-08-31 20:52:51 -04:00
1 parent e4764a67cc
commit 62e19185f1
3 files changed
+17 -9

No files matched your search

+2 -2
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",