@@ -20,6 +20,7 @@ import (
20
20
"github.com/lightningnetwork/lnd/keychain"
21
21
"github.com/lightningnetwork/lnd/lnrpc"
22
22
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
23
+ "github.com/lightningnetwork/lnd/lnrpc/verrpc"
23
24
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
24
25
"github.com/lightningnetwork/lnd/lnwallet"
25
26
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
@@ -219,6 +220,7 @@ type walletKitClient struct {
219
220
walletKitMac serializedMacaroon
220
221
timeout time.Duration
221
222
params * chaincfg.Params
223
+ version * verrpc.Version
222
224
}
223
225
224
226
// A compile time check to ensure that walletKitClient implements the
@@ -227,13 +229,15 @@ var _ WalletKitClient = (*walletKitClient)(nil)
227
229
228
230
func newWalletKitClient (conn grpc.ClientConnInterface ,
229
231
walletKitMac serializedMacaroon , timeout time.Duration ,
230
- chainParams * chaincfg.Params ) * walletKitClient {
232
+ chainParams * chaincfg.Params ,
233
+ version * verrpc.Version ) * walletKitClient {
231
234
232
235
return & walletKitClient {
233
236
client : walletrpc .NewWalletKitClient (conn ),
234
237
walletKitMac : walletKitMac ,
235
238
timeout : timeout ,
236
239
params : chainParams ,
240
+ version : version ,
237
241
}
238
242
}
239
243
@@ -771,6 +775,15 @@ func WithBudget(budget btcutil.Amount) BumpFeeOption {
771
775
}
772
776
}
773
777
778
+ // targetConfFixed is the minimum version in which bug #9470 is merged and new
779
+ // meaning of TargetConf is enabled. In versions prior to this version the field
780
+ // had a different meaning.
781
+ var targetConfFixed = & verrpc.Version {
782
+ AppMajor : 0 ,
783
+ AppMinor : 18 ,
784
+ AppPatch : 5 ,
785
+ }
786
+
774
787
// BumpFee attempts to bump the fee of a transaction by spending one of its
775
788
// outputs at the given fee rate. This essentially results in a
776
789
// child-pays-for-parent (CPFP) scenario. If the given output has been used in a
@@ -800,6 +813,19 @@ func (m *walletKitClient) BumpFee(ctx context.Context, op wire.OutPoint,
800
813
return fmt .Errorf ("can't use target_conf if feeRate != 0" )
801
814
}
802
815
816
+ // Make sure that the version of LND is at least targetConfFixed,
817
+ // because before it the meaning of TargetConf was different. See
818
+ // https://github.com/lightningnetwork/lnd/pull/9470
819
+ // TODO(Boris): remove this check when minimalCompatibleVersion
820
+ // is bumped to targetConfFixed.
821
+ if req .TargetConf != 0 {
822
+ err := AssertVersionCompatible (m .version , targetConfFixed )
823
+ if err != nil {
824
+ return fmt .Errorf ("can't use target_conf before " +
825
+ "version 0.18.5, see #9470" )
826
+ }
827
+ }
828
+
803
829
_ , err := m .client .BumpFee (m .walletKitMac .WithMacaroonAuth (rpcCtx ), req )
804
830
805
831
return err
0 commit comments