From a77225ba9ec42b986822999f599fa14dd92b6833 Mon Sep 17 00:00:00 2001
From: yyforyongyu <yy2452@columbia.edu>
Date: Fri, 4 Jun 2021 06:11:57 +0800
Subject: [PATCH] itest: allow set fee rate with conf target

In this commit, we add a method in fee service to allow specifying a fee
rate with a conf target.
---
 lntest/fee_service.go | 8 ++++++++
 lntest/harness.go     | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/lntest/fee_service.go b/lntest/fee_service.go
index 4f61649c..9f6634b0 100644
--- a/lntest/fee_service.go
+++ b/lntest/fee_service.go
@@ -100,3 +100,11 @@ func (f *feeService) setFee(fee chainfee.SatPerKWeight) {
 
 	f.Fees[feeServiceTarget] = uint32(fee.FeePerKVByte())
 }
+
+// setFeeWithConf sets a fee for the given confirmation target.
+func (f *feeService) setFeeWithConf(fee chainfee.SatPerKWeight, conf uint32) {
+	f.lock.Lock()
+	defer f.lock.Unlock()
+
+	f.Fees[conf] = uint32(fee.FeePerKVByte())
+}
diff --git a/lntest/harness.go b/lntest/harness.go
index d6885ca1..8ba49559 100644
--- a/lntest/harness.go
+++ b/lntest/harness.go
@@ -1512,6 +1512,12 @@ func (n *NetworkHarness) SetFeeEstimate(fee chainfee.SatPerKWeight) {
 	n.feeService.setFee(fee)
 }
 
+func (n *NetworkHarness) SetFeeEstimateWithConf(
+	fee chainfee.SatPerKWeight, conf uint32) {
+
+	n.feeService.setFeeWithConf(fee, conf)
+}
+
 // CopyFile copies the file src to dest.
 func CopyFile(dest, src string) error {
 	s, err := os.Open(src)