walletrpc: add sat_per_kw fee rate option
To allow more precise fee rates, we add a sat_per_kw option to the fee oneof in the gRPC definition.
This commit is contained in:
4 files changed
+37
-3
No files matched your search
@@ -3645,6 +3645,7 @@ type FundPsbtRequest struct {
|
|||||||
//
|
//
|
||||||
// *FundPsbtRequest_TargetConf
|
// *FundPsbtRequest_TargetConf
|
||||||
// *FundPsbtRequest_SatPerVbyte
|
// *FundPsbtRequest_SatPerVbyte
|
||||||
|
// *FundPsbtRequest_SatPerKw
|
||||||
Fees isFundPsbtRequest_Fees `protobuf_oneof:"fees"`
|
Fees isFundPsbtRequest_Fees `protobuf_oneof:"fees"`
|
||||||
// The name of the account to fund the PSBT with. If empty, the default wallet
|
// The name of the account to fund the PSBT with. If empty, the default wallet
|
||||||
// account is used.
|
// account is used.
|
||||||
@@ -3744,6 +3745,13 @@ func (x *FundPsbtRequest) GetSatPerVbyte() uint64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *FundPsbtRequest) GetSatPerKw() uint64 {
|
||||||
|
if x, ok := x.GetFees().(*FundPsbtRequest_SatPerKw); ok {
|
||||||
|
return x.SatPerKw
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (x *FundPsbtRequest) GetAccount() string {
|
func (x *FundPsbtRequest) GetAccount() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Account
|
return x.Account
|
||||||
@@ -3841,10 +3849,18 @@ type FundPsbtRequest_SatPerVbyte struct {
|
|||||||
SatPerVbyte uint64 `protobuf:"varint,4,opt,name=sat_per_vbyte,json=satPerVbyte,proto3,oneof"`
|
SatPerVbyte uint64 `protobuf:"varint,4,opt,name=sat_per_vbyte,json=satPerVbyte,proto3,oneof"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FundPsbtRequest_SatPerKw struct {
|
||||||
|
// The fee rate, expressed in sat/kWU, that should be used to spend the
|
||||||
|
// input with.
|
||||||
|
SatPerKw uint64 `protobuf:"varint,11,opt,name=sat_per_kw,json=satPerKw,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
func (*FundPsbtRequest_TargetConf) isFundPsbtRequest_Fees() {}
|
func (*FundPsbtRequest_TargetConf) isFundPsbtRequest_Fees() {}
|
||||||
|
|
||||||
func (*FundPsbtRequest_SatPerVbyte) isFundPsbtRequest_Fees() {}
|
func (*FundPsbtRequest_SatPerVbyte) isFundPsbtRequest_Fees() {}
|
||||||
|
|
||||||
|
func (*FundPsbtRequest_SatPerKw) isFundPsbtRequest_Fees() {}
|
||||||
|
|
||||||
type FundPsbtResponse struct {
|
type FundPsbtResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@@ -4905,7 +4921,7 @@ var file_walletrpc_walletkit_proto_rawDesc = []byte{
|
|||||||
0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18,
|
0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18,
|
||||||
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65,
|
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65,
|
||||||
0x22, 0x1a, 0x0a, 0x18, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63,
|
0x22, 0x1a, 0x0a, 0x18, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63,
|
||||||
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe6, 0x03, 0x0a,
|
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x86, 0x04, 0x0a,
|
||||||
0x0f, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x73, 0x62, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x0f, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x73, 0x62, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x12, 0x14, 0x0a, 0x04, 0x70, 0x73, 0x62, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00,
|
0x12, 0x14, 0x0a, 0x04, 0x70, 0x73, 0x62, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00,
|
||||||
0x52, 0x04, 0x70, 0x73, 0x62, 0x74, 0x12, 0x29, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20,
|
0x52, 0x04, 0x70, 0x73, 0x62, 0x74, 0x12, 0x29, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20,
|
||||||
@@ -4919,7 +4935,9 @@ var file_walletrpc_walletkit_proto_rawDesc = []byte{
|
|||||||
0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x6f,
|
0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x6f,
|
||||||
0x6e, 0x66, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x61, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x76, 0x62,
|
0x6e, 0x66, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x61, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x76, 0x62,
|
||||||
0x79, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x0b, 0x73, 0x61, 0x74,
|
0x79, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x0b, 0x73, 0x61, 0x74,
|
||||||
0x50, 0x65, 0x72, 0x56, 0x62, 0x79, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f,
|
0x50, 0x65, 0x72, 0x56, 0x62, 0x79, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x61, 0x74, 0x5f,
|
||||||
|
0x70, 0x65, 0x72, 0x5f, 0x6b, 0x77, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x08,
|
||||||
|
0x73, 0x61, 0x74, 0x50, 0x65, 0x72, 0x4b, 0x77, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f,
|
||||||
0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75,
|
0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75,
|
||||||
0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x73, 0x18,
|
0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x73, 0x18,
|
||||||
0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x73, 0x12,
|
0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x73, 0x12,
|
||||||
@@ -6200,6 +6218,7 @@ func file_walletrpc_walletkit_proto_init() {
|
|||||||
(*FundPsbtRequest_CoinSelect)(nil),
|
(*FundPsbtRequest_CoinSelect)(nil),
|
||||||
(*FundPsbtRequest_TargetConf)(nil),
|
(*FundPsbtRequest_TargetConf)(nil),
|
||||||
(*FundPsbtRequest_SatPerVbyte)(nil),
|
(*FundPsbtRequest_SatPerVbyte)(nil),
|
||||||
|
(*FundPsbtRequest_SatPerKw)(nil),
|
||||||
}
|
}
|
||||||
file_walletrpc_walletkit_proto_msgTypes[53].OneofWrappers = []interface{}{
|
file_walletrpc_walletkit_proto_msgTypes[53].OneofWrappers = []interface{}{
|
||||||
(*PsbtCoinSelect_ExistingOutputIndex)(nil),
|
(*PsbtCoinSelect_ExistingOutputIndex)(nil),
|
||||||
|
|||||||
@@ -1388,6 +1388,12 @@ message FundPsbtRequest {
|
|||||||
input with.
|
input with.
|
||||||
*/
|
*/
|
||||||
uint64 sat_per_vbyte = 4;
|
uint64 sat_per_vbyte = 4;
|
||||||
|
|
||||||
|
/*
|
||||||
|
The fee rate, expressed in sat/kWU, that should be used to spend the
|
||||||
|
input with.
|
||||||
|
*/
|
||||||
|
uint64 sat_per_kw = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1564,6 +1564,11 @@
|
|||||||
"format": "uint64",
|
"format": "uint64",
|
||||||
"description": "The fee rate, expressed in sat/vbyte, that should be used to spend the\ninput with."
|
"description": "The fee rate, expressed in sat/vbyte, that should be used to spend the\ninput with."
|
||||||
},
|
},
|
||||||
|
"sat_per_kw": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uint64",
|
||||||
|
"description": "The fee rate, expressed in sat/kWU, that should be used to spend the\ninput with."
|
||||||
|
},
|
||||||
"account": {
|
"account": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The name of the account to fund the PSBT with. If empty, the default wallet\naccount is used."
|
"description": "The name of the account to fund the PSBT with. If empty, the default wallet\naccount is used."
|
||||||
|
|||||||
@@ -1511,9 +1511,13 @@ func (w *WalletKit) FundPsbt(_ context.Context,
|
|||||||
req.GetSatPerVbyte() * 1000,
|
req.GetSatPerVbyte() * 1000,
|
||||||
).FeePerKWeight()
|
).FeePerKWeight()
|
||||||
|
|
||||||
|
case req.GetSatPerKw() != 0:
|
||||||
|
feeSatPerKW = chainfee.SatPerKWeight(req.GetSatPerKw())
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("fee definition missing, need to " +
|
return nil, fmt.Errorf("fee definition missing, need to " +
|
||||||
"specify either target_conf or sat_per_vbyte")
|
"specify either target_conf, sat_per_vbyte or " +
|
||||||
|
"sat_per_kw")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then, we'll extract the minimum number of confirmations that each
|
// Then, we'll extract the minimum number of confirmations that each
|
||||||
|
|||||||
Reference in new issue
Block a user