@@ -1027,7 +1027,7 @@ func (c *OpenChannel) UpdateCommitment(newCommitment *ChannelCommitment) error {
1027
1027
return ErrNoRestoredChannelMutation
1028
1028
}
1029
1029
1030
- err := c .Db .Update (func (tx * bbolt.Tx ) error {
1030
+ err := c .Db .Batch (func (tx * bbolt.Tx ) error {
1031
1031
chanBucket , err := fetchChanBucket (
1032
1032
tx , c .IdentityPub , & c .FundingOutpoint , c .ChainHash ,
1033
1033
)
@@ -1465,7 +1465,7 @@ func (c *OpenChannel) AppendRemoteCommitChain(diff *CommitDiff) error {
1465
1465
return ErrNoRestoredChannelMutation
1466
1466
}
1467
1467
1468
- return c .Db .Update (func (tx * bbolt.Tx ) error {
1468
+ return c .Db .Batch (func (tx * bbolt.Tx ) error {
1469
1469
// First, we'll grab the writable bucket where this channel's
1470
1470
// data resides.
1471
1471
chanBucket , err := fetchChanBucket (
@@ -1608,7 +1608,9 @@ func (c *OpenChannel) AdvanceCommitChainTail(fwdPkg *FwdPkg) error {
1608
1608
1609
1609
var newRemoteCommit * ChannelCommitment
1610
1610
1611
- err := c .Db .Update (func (tx * bbolt.Tx ) error {
1611
+ err := c .Db .Batch (func (tx * bbolt.Tx ) error {
1612
+ newRemoteCommit = nil
1613
+
1612
1614
chanBucket , err := fetchChanBucket (
1613
1615
tx , c .IdentityPub , & c .FundingOutpoint , c .ChainHash ,
1614
1616
)
@@ -1746,7 +1748,7 @@ func (c *OpenChannel) AckAddHtlcs(addRefs ...AddRef) error {
1746
1748
c .Lock ()
1747
1749
defer c .Unlock ()
1748
1750
1749
- return c .Db .Update (func (tx * bbolt.Tx ) error {
1751
+ return c .Db .Batch (func (tx * bbolt.Tx ) error {
1750
1752
return c .Packager .AckAddHtlcs (tx , addRefs ... )
1751
1753
})
1752
1754
}
@@ -1759,7 +1761,7 @@ func (c *OpenChannel) AckSettleFails(settleFailRefs ...SettleFailRef) error {
1759
1761
c .Lock ()
1760
1762
defer c .Unlock ()
1761
1763
1762
- return c .Db .Update (func (tx * bbolt.Tx ) error {
1764
+ return c .Db .Batch (func (tx * bbolt.Tx ) error {
1763
1765
return c .Packager .AckSettleFails (tx , settleFailRefs ... )
1764
1766
})
1765
1767
}
@@ -1770,7 +1772,7 @@ func (c *OpenChannel) SetFwdFilter(height uint64, fwdFilter *PkgFilter) error {
1770
1772
c .Lock ()
1771
1773
defer c .Unlock ()
1772
1774
1773
- return c .Db .Update (func (tx * bbolt.Tx ) error {
1775
+ return c .Db .Batch (func (tx * bbolt.Tx ) error {
1774
1776
return c .Packager .SetFwdFilter (tx , height , fwdFilter )
1775
1777
})
1776
1778
}
@@ -1783,14 +1785,15 @@ func (c *OpenChannel) RemoveFwdPkg(height uint64) error {
1783
1785
c .Lock ()
1784
1786
defer c .Unlock ()
1785
1787
1786
- return c .Db .Update (func (tx * bbolt.Tx ) error {
1788
+ return c .Db .Batch (func (tx * bbolt.Tx ) error {
1787
1789
return c .Packager .RemovePkg (tx , height )
1788
1790
})
1789
1791
}
1790
1792
1791
1793
// RevocationLogTail returns the "tail", or the end of the current revocation
1792
1794
// log. This entry represents the last previous state for the remote node's
1793
- // commitment chain. The ChannelDelta returned by this method will always lag one state behind the most current (unrevoked) state of the remote node's
1795
+ // commitment chain. The ChannelDelta returned by this method will always lag
1796
+ // one state behind the most current (unrevoked) state of the remote node's
1794
1797
// commitment chain.
1795
1798
func (c * OpenChannel ) RevocationLogTail () (* ChannelCommitment , error ) {
1796
1799
c .RLock ()
0 commit comments