@@ -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
@@ -775,6 +779,15 @@ func WithBudget(budget btcutil.Amount) BumpFeeOption {
775
779
}
776
780
}
777
781
782
+ // targetConfFixed is the minimum version in which bug #9470 is merged and new
783
+ // meaning of TargetConf is enabled. In versions prior to this version the field
784
+ // had a different meaning.
785
+ var targetConfFixed = & verrpc.Version {
786
+ AppMajor : 0 ,
787
+ AppMinor : 18 ,
788
+ AppPatch : 5 ,
789
+ }
790
+
778
791
// BumpFee attempts to bump the fee of a transaction by spending one of its
779
792
// outputs at the given fee rate. This essentially results in a
780
793
// child-pays-for-parent (CPFP) scenario. If the given output has been used in a
@@ -799,6 +812,20 @@ func (m *walletKitClient) BumpFee(ctx context.Context, op wire.OutPoint,
799
812
opt (req )
800
813
}
801
814
815
+ // Make sure that the version of LND is at least targetConfFixed,
816
+ // because before it the meaning of TargetConf was different. See
817
+ // https://github.com/lightningnetwork/lnd/pull/9470
818
+ // TODO(Boris): remove this check when minimalCompatibleVersion
819
+ // is bumped to targetConfFixed.
820
+ if req .TargetConf != 0 {
821
+ err := AssertVersionCompatible (m .version , targetConfFixed )
822
+ if err != nil {
823
+ return fmt .Errorf ("can't use target_conf before " +
824
+ "version %s, current LND version is %s, " +
825
+ "see #9470" , targetConfFixed , m .version )
826
+ }
827
+ }
828
+
802
829
_ , err := m .client .BumpFee (m .walletKitMac .WithMacaroonAuth (rpcCtx ), req )
803
830
804
831
return err
0 commit comments