@@ -1723,11 +1723,42 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
1723
1723
// min relay fee rate is used as the current fee rate.
1724
1724
assertFeeRateEqual (startFeeRate )
1725
1725
1726
+ // First we test the case where we specify the conf target to increase
1727
+ // the starting fee rate of the fee function.
1728
+ confTargetFeeRate := chainfee .SatPerVByte (50 )
1729
+ ht .SetFeeEstimateWithConf (confTargetFeeRate .FeePerKWeight (), 3 )
1730
+
1731
+ // Second bump request - we will specify the conf target and expect a
1732
+ // starting fee rate that is estimated using the provided estimator.
1733
+ // - starting fee rate: 50 sat/vbyte (conf target 3).
1734
+ // - deadline: 1008 (default deadline).
1735
+ // - budget: 50% of the input value.
1736
+ bumpFeeReq = & walletrpc.BumpFeeRequest {
1737
+ Outpoint : op ,
1738
+ // We use a force param to create the sweeping tx immediately.
1739
+ Immediate : true ,
1740
+ TargetConf : 3 ,
1741
+ }
1742
+
1743
+ alice .RPC .BumpFee (bumpFeeReq )
1744
+
1745
+ // Alice's old sweeping tx should be replaced.
1746
+ ht .AssertTxNotInMempool (sweepTx1 .TxHash ())
1747
+
1748
+ // Assert the pending sweep is created with the expected values:
1749
+ // - broadcast attempts: 2.
1750
+ // - starting fee rate: 50 sat/vbyte (conf target 3).
1751
+ // - deadline: 1008 (default deadline).
1752
+ // - budget: 50% of the input value.
1753
+ sweepTx2 := assertPendingSweepResp (
1754
+ 2 , uint64 (value / 2 ), deadline , uint64 (confTargetFeeRate ),
1755
+ )
1756
+
1726
1757
// testFeeRate sepcifies a starting fee rate in sat/vbyte.
1727
1758
const testFeeRate = uint64 (100 )
1728
1759
1729
- // Second bump request - we will specify the fee rate and expect a fee
1730
- // func that has ,
1760
+ // Third bump request - we will specify the fee rate and expect a fee
1761
+ // func to change the starting fee rate of the fee function ,
1731
1762
// - starting fee rate: 100 sat/vbyte.
1732
1763
// - deadline: 1008 (default deadline).
1733
1764
// - budget: 50% of the input value.
@@ -1740,15 +1771,15 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
1740
1771
alice .RPC .BumpFee (bumpFeeReq )
1741
1772
1742
1773
// Alice's old sweeping tx should be replaced.
1743
- ht .AssertTxNotInMempool (sweepTx1 .TxHash ())
1774
+ ht .AssertTxNotInMempool (sweepTx2 .TxHash ())
1744
1775
1745
1776
// Assert the pending sweep is created with the expected values:
1746
- // - broadcast attempts: 2 .
1777
+ // - broadcast attempts: 3 .
1747
1778
// - starting fee rate: 100 sat/vbyte.
1748
1779
// - deadline: 1008 (default deadline).
1749
1780
// - budget: 50% of the input value.
1750
- sweepTx2 := assertPendingSweepResp (
1751
- 2 , uint64 (value / 2 ), deadline , testFeeRate ,
1781
+ sweepTx3 := assertPendingSweepResp (
1782
+ 3 , uint64 (value / 2 ), deadline , testFeeRate ,
1752
1783
)
1753
1784
1754
1785
// We expect the requested starting fee rate to be the current fee
@@ -1758,7 +1789,7 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
1758
1789
// testBudget specifies a budget in sats.
1759
1790
testBudget := uint64 (float64 (value ) * 0.1 )
1760
1791
1761
- // Third bump request - we will specify the budget and expect a fee
1792
+ // Fourth bump request - we will specify the budget and expect a fee
1762
1793
// func that has,
1763
1794
// - starting fee rate: 100 sat/vbyte, stays unchanged.
1764
1795
// - deadline: 1008 (default deadline).
@@ -1772,14 +1803,14 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
1772
1803
alice .RPC .BumpFee (bumpFeeReq )
1773
1804
1774
1805
// Alice's old sweeping tx should be replaced.
1775
- ht .AssertTxNotInMempool (sweepTx2 .TxHash ())
1806
+ ht .AssertTxNotInMempool (sweepTx3 .TxHash ())
1776
1807
1777
1808
// Assert the pending sweep is created with the expected values:
1778
- // - broadcast attempts: 3 .
1809
+ // - broadcast attempts: 4 .
1779
1810
// - starting fee rate: 100 sat/vbyte, stays unchanged.
1780
1811
// - deadline: 1008 (default deadline).
1781
1812
// - budget: 10% of the input value.
1782
- sweepTx3 := assertPendingSweepResp (3 , testBudget , deadline , 0 )
1813
+ sweepTx4 := assertPendingSweepResp (4 , testBudget , deadline , testFeeRate )
1783
1814
1784
1815
// We expect the current fee rate to be increased because we ensure the
1785
1816
// initial broadcast always succeeds.
@@ -1789,34 +1820,37 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
1789
1820
testDeadlineDelta := uint32 (100 )
1790
1821
deadlineHeight := uint32 (currentHeight ) + testDeadlineDelta
1791
1822
1792
- // Fourth bump request - we will specify the deadline and expect a fee
1823
+ // Fifth bump request - we will specify the deadline and expect a fee
1793
1824
// func that has,
1794
1825
// - starting fee rate: 100 sat/vbyte, stays unchanged.
1795
1826
// - deadline: 100.
1796
1827
// - budget: 10% of the input value, stays unchanged.
1797
1828
bumpFeeReq = & walletrpc.BumpFeeRequest {
1798
1829
Outpoint : op ,
1799
1830
// We use a force param to create the sweeping tx immediately.
1800
- Immediate : true ,
1801
- TargetConf : testDeadlineDelta ,
1831
+ Immediate : true ,
1832
+ DeadlineDelta : testDeadlineDelta ,
1833
+ Budget : testBudget ,
1802
1834
}
1803
1835
alice .RPC .BumpFee (bumpFeeReq )
1804
1836
1805
1837
// Alice's old sweeping tx should be replaced.
1806
- ht .AssertTxNotInMempool (sweepTx3 .TxHash ())
1838
+ ht .AssertTxNotInMempool (sweepTx4 .TxHash ())
1807
1839
1808
1840
// Assert the pending sweep is created with the expected values:
1809
- // - broadcast attempts: 4 .
1841
+ // - broadcast attempts: 5 .
1810
1842
// - starting fee rate: 100 sat/vbyte, stays unchanged.
1811
1843
// - deadline: 100.
1812
1844
// - budget: 10% of the input value, stays unchanged.
1813
- sweepTx4 := assertPendingSweepResp (4 , testBudget , deadlineHeight , 0 )
1845
+ sweepTx5 := assertPendingSweepResp (
1846
+ 5 , testBudget , deadlineHeight , testFeeRate ,
1847
+ )
1814
1848
1815
1849
// We expect the current fee rate to be increased because we ensure the
1816
1850
// initial broadcast always succeeds.
1817
1851
assertFeeRateGreater (testFeeRate )
1818
1852
1819
- // Fifth bump request - we test the behavior of `Immediate` - every
1853
+ // Sixth bump request - we test the behavior of `Immediate` - every
1820
1854
// time it's called, the fee function will keep increasing the fee rate
1821
1855
// until the broadcast can succeed. The fee func that has,
1822
1856
// - starting fee rate: 100 sat/vbyte, stays unchanged.
@@ -1830,14 +1864,16 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
1830
1864
alice .RPC .BumpFee (bumpFeeReq )
1831
1865
1832
1866
// Alice's old sweeping tx should be replaced.
1833
- ht .AssertTxNotInMempool (sweepTx4 .TxHash ())
1867
+ ht .AssertTxNotInMempool (sweepTx5 .TxHash ())
1834
1868
1835
1869
// Assert the pending sweep is created with the expected values:
1836
- // - broadcast attempts: 5 .
1870
+ // - broadcast attempts: 6 .
1837
1871
// - starting fee rate: 100 sat/vbyte, stays unchanged.
1838
1872
// - deadline: 100, stays unchanged.
1839
1873
// - budget: 10% of the input value, stays unchanged.
1840
- sweepTx5 := assertPendingSweepResp (5 , testBudget , deadlineHeight , 0 )
1874
+ sweepTx6 := assertPendingSweepResp (
1875
+ 6 , testBudget , deadlineHeight , testFeeRate ,
1876
+ )
1841
1877
1842
1878
// We expect the current fee rate to be increased because we ensure the
1843
1879
// initial broadcast always succeeds.
@@ -1855,26 +1891,27 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
1855
1891
// We use a force param to create the sweeping tx immediately.
1856
1892
Immediate : true ,
1857
1893
SatPerVbyte : startFeeRate ,
1858
- Budget : smallBudget ,
1859
- TargetConf : uint32 (sweep .DefaultDeadlineDelta ),
1894
+ // The budget and the deadline delta must be set together.
1895
+ Budget : smallBudget ,
1896
+ DeadlineDelta : uint32 (sweep .DefaultDeadlineDelta ),
1860
1897
}
1861
1898
alice .RPC .BumpFee (bumpFeeReq )
1862
1899
1863
1900
// Assert the pending sweep is created with the expected values:
1864
- // - broadcast attempts: 6 .
1901
+ // - broadcast attempts: 7 .
1865
1902
// - starting fee rate: 1 sat/vbyte.
1866
1903
// - deadline: 1008.
1867
1904
// - budget: 1000 sats.
1868
- sweepTx6 := assertPendingSweepResp (
1869
- 6 , smallBudget , deadline , startFeeRate ,
1905
+ sweepTx7 := assertPendingSweepResp (
1906
+ 7 , smallBudget , deadline , startFeeRate ,
1870
1907
)
1871
1908
1872
1909
// Since this budget is too small to cover the RBF, we expect the
1873
1910
// sweeping attempt to fail.
1874
1911
//
1875
- require .Equal (ht , sweepTx5 .TxHash (), sweepTx6 .TxHash (), "tx5 should " +
1876
- "not be replaced: tx5 =%v, tx6 =%v" , sweepTx5 .TxHash (),
1877
- sweepTx6 .TxHash ())
1912
+ require .Equal (ht , sweepTx6 .TxHash (), sweepTx7 .TxHash (), "tx6 should " +
1913
+ "not be replaced: tx6 =%v, tx7 =%v" , sweepTx6 .TxHash (),
1914
+ sweepTx7 .TxHash ())
1878
1915
1879
1916
// We expect the current fee rate to be increased because we ensure the
1880
1917
// initial broadcast always succeeds.
0 commit comments