lnrpc/walletrpc: expose bumping fee of inputs/transactions over RPC
This RPC exposes the recently added BumpFee functionality to the UtxoSweeper in order to allow users of the RPC to manually bump fees of low fee inputs/transactions.
This commit is contained in:
parent
e69d93949c
commit
a4675063b7
@ -676,6 +676,97 @@ func (m *PendingSweepsResponse) GetPendingSweeps() []*PendingSweep {
|
||||
return nil
|
||||
}
|
||||
|
||||
type BumpFeeRequest struct {
|
||||
// The input we're attempting to bump the fee of.
|
||||
Outpoint *lnrpc.OutPoint `protobuf:"bytes,1,opt,name=outpoint,proto3" json:"outpoint,omitempty"`
|
||||
// The target number of blocks that the input should be spent within.
|
||||
TargetConf uint32 `protobuf:"varint,2,opt,name=target_conf,proto3" json:"target_conf,omitempty"`
|
||||
//
|
||||
//The fee rate, expressed in sat/byte, that should be used to spend the input
|
||||
//with.
|
||||
SatPerByte uint32 `protobuf:"varint,3,opt,name=sat_per_byte,proto3" json:"sat_per_byte,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *BumpFeeRequest) Reset() { *m = BumpFeeRequest{} }
|
||||
func (m *BumpFeeRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*BumpFeeRequest) ProtoMessage() {}
|
||||
func (*BumpFeeRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6cc6942ac78249e5, []int{12}
|
||||
}
|
||||
|
||||
func (m *BumpFeeRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_BumpFeeRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *BumpFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_BumpFeeRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *BumpFeeRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_BumpFeeRequest.Merge(m, src)
|
||||
}
|
||||
func (m *BumpFeeRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_BumpFeeRequest.Size(m)
|
||||
}
|
||||
func (m *BumpFeeRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_BumpFeeRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_BumpFeeRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *BumpFeeRequest) GetOutpoint() *lnrpc.OutPoint {
|
||||
if m != nil {
|
||||
return m.Outpoint
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *BumpFeeRequest) GetTargetConf() uint32 {
|
||||
if m != nil {
|
||||
return m.TargetConf
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *BumpFeeRequest) GetSatPerByte() uint32 {
|
||||
if m != nil {
|
||||
return m.SatPerByte
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type BumpFeeResponse struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *BumpFeeResponse) Reset() { *m = BumpFeeResponse{} }
|
||||
func (m *BumpFeeResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*BumpFeeResponse) ProtoMessage() {}
|
||||
func (*BumpFeeResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6cc6942ac78249e5, []int{13}
|
||||
}
|
||||
|
||||
func (m *BumpFeeResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_BumpFeeResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *BumpFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_BumpFeeResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *BumpFeeResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_BumpFeeResponse.Merge(m, src)
|
||||
}
|
||||
func (m *BumpFeeResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_BumpFeeResponse.Size(m)
|
||||
}
|
||||
func (m *BumpFeeResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_BumpFeeResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_BumpFeeResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("walletrpc.WitnessType", WitnessType_name, WitnessType_value)
|
||||
proto.RegisterType((*KeyReq)(nil), "walletrpc.KeyReq")
|
||||
@ -690,70 +781,75 @@ func init() {
|
||||
proto.RegisterType((*PendingSweep)(nil), "walletrpc.PendingSweep")
|
||||
proto.RegisterType((*PendingSweepsRequest)(nil), "walletrpc.PendingSweepsRequest")
|
||||
proto.RegisterType((*PendingSweepsResponse)(nil), "walletrpc.PendingSweepsResponse")
|
||||
proto.RegisterType((*BumpFeeRequest)(nil), "walletrpc.BumpFeeRequest")
|
||||
proto.RegisterType((*BumpFeeResponse)(nil), "walletrpc.BumpFeeResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("walletrpc/walletkit.proto", fileDescriptor_6cc6942ac78249e5) }
|
||||
|
||||
var fileDescriptor_6cc6942ac78249e5 = []byte{
|
||||
// 918 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0x5d, 0x6f, 0xe2, 0x46,
|
||||
0x14, 0x2d, 0x21, 0x61, 0xc3, 0x05, 0x12, 0xef, 0x10, 0x12, 0x97, 0xcd, 0x6e, 0xa8, 0xfb, 0x21,
|
||||
0xd4, 0x56, 0xa0, 0x66, 0xdb, 0xaa, 0x6a, 0x1f, 0xaa, 0x14, 0x1c, 0x11, 0xf1, 0x61, 0x6a, 0x3b,
|
||||
0x9b, 0x6e, 0x55, 0x69, 0x64, 0x60, 0x16, 0x2c, 0xc0, 0x76, 0xc6, 0x43, 0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, 0x43, 0x71, 0x6d, 0x33, 0x87, 0xf8, 0x3e,
|
||||
0x66, 0x81, 0x47, 0xf8, 0x39, 0x1f, 0x5d, 0x9e, 0x36, 0xb6, 0x97, 0xab, 0x71, 0x17, 0xd1, 0x66,
|
||||
0xe0, 0x11, 0x3d, 0xa5, 0x45, 0x6f, 0x00, 0xac, 0xa5, 0xbb, 0x72, 0x18, 0xf6, 0x2d, 0x26, 0x67,
|
||||
0x6b, 0x99, 0x7a, 0x49, 0x17, 0x10, 0xa4, 0x40, 0x31, 0xe9, 0x7b, 0x14, 0x30, 0x22, 0xef, 0x73,
|
||||
0x45, 0x0a, 0x43, 0x0d, 0x40, 0x23, 0xea, 0x5a, 0x93, 0xb1, 0xe5, 0x33, 0x6c, 0x31, 0x46, 0x96,
|
||||
0x1e, 0xf3, 0xe5, 0x03, 0xae, 0x7c, 0x82, 0x41, 0xdf, 0x43, 0xc5, 0x21, 0x1b, 0x86, 0x1f, 0xa8,
|
||||
0x19, 0xb1, 0xa7, 0x33, 0x26, 0xe7, 0x78, 0xc9, 0xd3, 0xa4, 0x72, 0x0a, 0x27, 0xe2, 0x88, 0x92,
|
||||
0xdb, 0xa1, 0xfc, 0x01, 0x95, 0x1d, 0x3c, 0x1e, 0xf9, 0xaf, 0x70, 0xe4, 0x45, 0x04, 0xf6, 0x39,
|
||||
0x23, 0x67, 0xf8, 0xfd, 0x38, 0x13, 0x06, 0x23, 0x56, 0xea, 0x3b, 0xf2, 0xaf, 0xff, 0xc9, 0x42,
|
||||
0x41, 0x98, 0x1c, 0x2a, 0xc3, 0xf1, 0xed, 0xa0, 0x3b, 0xd0, 0xee, 0x06, 0xf8, 0xee, 0xc6, 0x1c,
|
||||
0xa8, 0x86, 0x21, 0x7d, 0x82, 0x64, 0x38, 0x69, 0x69, 0xfd, 0xfe, 0x8d, 0xd9, 0x57, 0x07, 0x26,
|
||||
0x36, 0x6f, 0xfa, 0x2a, 0xee, 0x69, 0xad, 0xae, 0x94, 0x41, 0x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0xb4, 0x89, 0x3f, 0xa6, 0xb6, 0xc7, 0x5c,
|
||||
0x8a, 0x7e, 0x82, 0x7c, 0x54, 0x1b, 0xd6, 0x95, 0x45, 0x51, 0xcf, 0x1d, 0x5b, 0xcc, 0xa5, 0xcf,
|
||||
0x56, 0xfe, 0x02, 0x87, 0xe1, 0x7a, 0x61, 0x38, 0x22, 0xf1, 0x59, 0x09, 0xe1, 0x59, 0x3d, 0x7b,
|
||||
0x84, 0xc7, 0xd7, 0xb0, 0x03, 0x28, 0xce, 0x42, 0x31, 0x38, 0x45, 0x1b, 0x01, 0xaf, 0x56, 0xc5,
|
||||
0xcb, 0xb9, 0x13, 0xa1, 0x3d, 0x28, 0x08, 0xf9, 0x85, 0x5e, 0x0b, 0xd2, 0xc7, 0xa9, 0x59, 0x7d,
|
||||
0xf3, 0x1c, 0xfd, 0xe0, 0x26, 0x04, 0x55, 0xca, 0xed, 0x71, 0xee, 0xa5, 0xdc, 0x9e, 0xca, 0x37,
|
||||
0x1d, 0x4a, 0xa9, 0x57, 0x88, 0x2e, 0x9e, 0x79, 0x65, 0xdb, 0xfe, 0x6a, 0xcf, 0x0b, 0x22, 0xcf,
|
||||
0xdf, 0xbe, 0xfb, 0xb3, 0x39, 0xb5, 0xd9, 0x6c, 0x35, 0x6a, 0x8c, 0xdd, 0x65, 0x73, 0x11, 0xa6,
|
||||
0x80, 0x63, 0x3b, 0x53, 0x87, 0xb0, 0xb5, 0x4b, 0xe7, 0xcd, 0x85, 0x33, 0x69, 0xf2, 0x4c, 0x6c,
|
||||
0x6e, 0x8d, 0x46, 0x39, 0xfe, 0x5b, 0xf9, 0xf6, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xc4,
|
||||
0xea, 0x93, 0x74, 0x07, 0x00, 0x00,
|
||||
// 976 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xed, 0x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xf8, 0x4c, 0x51, 0x20, 0x1f, 0xfe,
|
||||
0xeb, 0x7b, 0xae, 0xe3, 0x13, 0x84, 0x60, 0xdf, 0x1a, 0x8d, 0x28, 0xf7, 0xce, 0xea, 0xfc, 0x5b,
|
||||
0xf9, 0x14, 0x72, 0x26, 0xb5, 0x1c, 0xdf, 0x1a, 0x32, 0xdb, 0x75, 0x50, 0x09, 0x32, 0x6c, 0x85,
|
||||
0x27, 0x64, 0xc5, 0x45, 0x79, 0xfd, 0x80, 0xad, 0x5a, 0x64, 0xa5, 0x7c, 0x07, 0xc7, 0xfd, 0xc5,
|
||||
0x60, 0x66, 0xfb, 0x93, 0x8d, 0xd9, 0x27, 0x50, 0xf0, 0x42, 0x08, 0x13, 0x4a, 0xdd, 0xd8, 0x35,
|
||||
0x1f, 0x81, 0x6a, 0x80, 0x29, 0xbf, 0x03, 0x32, 0x88, 0x33, 0xd2, 0x16, 0xcc, 0x5b, 0x30, 0x3f,
|
||||
0xea, 0x0b, 0x5d, 0x00, 0xf8, 0x16, 0xc3, 0x1e, 0xa1, 0x78, 0xba, 0xe4, 0x75, 0x69, 0xfd, 0xd0,
|
||||
0xb7, 0x58, 0x9f, 0xd0, 0xf6, 0x12, 0x55, 0xe1, 0x99, 0x1b, 0xea, 0xe5, 0xbd, 0x4a, 0xba, 0x9a,
|
||||
0xbb, 0x3a, 0xaa, 0x45, 0xf3, 0xab, 0x99, 0x2b, 0x6d, 0xc1, 0xf4, 0x98, 0x56, 0xbe, 0x82, 0x62,
|
||||
0xc2, 0x3d, 0xea, 0xac, 0x04, 0x19, 0x6a, 0x2d, 0x31, 0xdb, 0xec, 0x81, 0x5a, 0x4b, 0x73, 0xa5,
|
||||
0x7c, 0x0b, 0x48, 0xf5, 0x99, 0x3d, 0xb7, 0x18, 0xb9, 0x21, 0x24, 0xee, 0xe5, 0x12, 0x72, 0x43,
|
||||
0xd7, 0x79, 0x8f, 0x99, 0x45, 0xc7, 0x24, 0x1e, 0x3b, 0x04, 0x90, 0xc9, 0x11, 0xe5, 0x35, 0x14,
|
||||
0x13, 0x65, 0xd1, 0x22, 0xff, 0xb9, 0x07, 0xe5, 0xef, 0x3d, 0xc8, 0xf7, 0x89, 0x33, 0xb2, 0x9d,
|
||||
0xb1, 0xb1, 0x24, 0xc4, 0x43, 0x5f, 0xc2, 0x61, 0xd0, 0xb5, 0x1b, 0x1f, 0x6d, 0xee, 0xea, 0xb8,
|
||||
0x36, 0xe3, 0x7b, 0xd2, 0x16, 0xac, 0x1f, 0xc0, 0xfa, 0x46, 0x80, 0x7e, 0x80, 0xfc, 0xd2, 0x66,
|
||||
0x0e, 0xf1, 0x7d, 0xcc, 0xd6, 0x1e, 0xe1, 0xe7, 0x7c, 0x74, 0x75, 0x56, 0xdb, 0x5c, 0xae, 0xda,
|
||||
0x7d, 0x48, 0x9b, 0x6b, 0x8f, 0xe8, 0x09, 0x2d, 0x7a, 0x05, 0x60, 0xcd, 0xdd, 0x85, 0xc3, 0xb0,
|
||||
0x6f, 0x31, 0x39, 0x5d, 0x49, 0x55, 0x0b, 0xba, 0x80, 0x20, 0x05, 0xf2, 0x71, 0xdf, 0x83, 0x35,
|
||||
0x23, 0xf2, 0x3e, 0x57, 0x24, 0x30, 0x54, 0x03, 0x34, 0xa0, 0xae, 0x35, 0x1a, 0x5a, 0x3e, 0xc3,
|
||||
0x16, 0x63, 0x64, 0xee, 0x31, 0x5f, 0x3e, 0xe0, 0xca, 0x47, 0x18, 0xf4, 0x0d, 0x94, 0x1c, 0xb2,
|
||||
0x62, 0xf8, 0x81, 0x9a, 0x10, 0x7b, 0x3c, 0x61, 0x72, 0x86, 0x97, 0x3c, 0x4e, 0x2a, 0x67, 0x70,
|
||||
0x2a, 0x8e, 0x28, 0xbe, 0x1d, 0xca, 0xaf, 0x50, 0xda, 0xc2, 0xa3, 0x91, 0xff, 0x04, 0x47, 0x5e,
|
||||
0x48, 0x60, 0x9f, 0x33, 0x72, 0x8a, 0xdf, 0x8f, 0x73, 0x61, 0x30, 0x62, 0xa5, 0xbe, 0x25, 0x57,
|
||||
0xfe, 0x4a, 0xc1, 0xd1, 0x9b, 0xc5, 0xdc, 0x13, 0x8e, 0xff, 0x7f, 0x9d, 0x4b, 0x05, 0x72, 0xe1,
|
||||
0x35, 0xc1, 0xc1, 0xfd, 0xe0, 0xc7, 0x52, 0xd0, 0x45, 0x68, 0x67, 0xba, 0xe9, 0xdd, 0xe9, 0x2a,
|
||||
0x27, 0x70, 0xbc, 0x69, 0x22, 0xdc, 0xd9, 0x17, 0x7f, 0xa6, 0x21, 0x27, 0x1c, 0x29, 0x2a, 0xc2,
|
||||
0xf1, 0x5d, 0xaf, 0xdd, 0xd3, 0xee, 0x7b, 0xf8, 0xfe, 0xd6, 0xec, 0xa9, 0x86, 0x21, 0x7d, 0x84,
|
||||
0x64, 0x38, 0x6d, 0x68, 0xdd, 0xee, 0xad, 0xd9, 0x55, 0x7b, 0x26, 0x36, 0x6f, 0xbb, 0x2a, 0xee,
|
||||
0x68, 0x8d, 0xb6, 0x94, 0x42, 0xe7, 0x50, 0x14, 0x98, 0x9e, 0x86, 0x9b, 0x6a, 0xe7, 0xfa, 0x9d,
|
||||
0xb4, 0x87, 0x4a, 0x70, 0x22, 0x10, 0xba, 0xfa, 0x56, 0x6b, 0xab, 0x52, 0x3a, 0xd0, 0xb7, 0xcc,
|
||||
0x4e, 0x03, 0x6b, 0x37, 0x37, 0xaa, 0xae, 0x36, 0x63, 0x62, 0x3f, 0x58, 0x82, 0x13, 0xd7, 0x8d,
|
||||
0x86, 0xda, 0x37, 0x1f, 0x98, 0x03, 0xf4, 0x19, 0x7c, 0x9c, 0x28, 0x09, 0x96, 0xd7, 0xee, 0x4c,
|
||||
0x6c, 0xa8, 0x0d, 0xad, 0xd7, 0xc4, 0x1d, 0xf5, 0xad, 0xda, 0x91, 0x32, 0xe8, 0x73, 0x50, 0x92,
|
||||
0x06, 0xc6, 0x5d, 0xa3, 0xa1, 0x1a, 0x46, 0x52, 0xf7, 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xb7, 0xc7, 0x82, 0x57, 0x87, 0x42, 0x22, 0x1e, 0xd0,
|
||||
0xe5, 0x13, 0xcf, 0x7f, 0xd3, 0x5f, 0xe5, 0x69, 0x41, 0xe4, 0xf9, 0x33, 0x3c, 0x8b, 0x9e, 0x24,
|
||||
0x7a, 0x2e, 0x88, 0x93, 0x59, 0x91, 0x98, 0xd8, 0xd6, 0x0b, 0x7e, 0xf3, 0xf5, 0x6f, 0xf5, 0xb1,
|
||||
0xcd, 0x26, 0x8b, 0x41, 0x6d, 0xe8, 0xce, 0xeb, 0xb3, 0x20, 0xe0, 0x1c, 0xdb, 0x19, 0x3b, 0x84,
|
||||
0x2d, 0x5d, 0x3a, 0xad, 0xcf, 0x9c, 0x51, 0x9d, 0xc7, 0x4a, 0x7d, 0x63, 0x31, 0xc8, 0xf0, 0x9f,
|
||||
0x01, 0xaf, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xd3, 0xc7, 0x77, 0x11, 0x4f, 0x08, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -806,6 +902,33 @@ type WalletKitClient interface {
|
||||
//remain supported. This is an advanced API that depends on the internals of
|
||||
//the UtxoSweeper, so things may change.
|
||||
PendingSweeps(ctx context.Context, in *PendingSweepsRequest, opts ...grpc.CallOption) (*PendingSweepsResponse, error)
|
||||
//
|
||||
//Bump the fee of an arbitrary input within a transaction. This RPC takes a
|
||||
//different approach than bitcoind's bumpfee command. lnd has a central
|
||||
//batching engine in which inputs with similar fee rates are batched together
|
||||
//to save on transaction fees. Due to this, we cannot rely on bumping the fee
|
||||
//on a specific transaction, since transactions can change at any point with
|
||||
//the addition of new inputs. The list of inputs that currently exist within
|
||||
//lnd's central batching engine can be retrieved through the PendingSweeps
|
||||
//RPC.
|
||||
//
|
||||
//When bumping the fee of an input that currently exists within lnd's central
|
||||
//batching engine, a higher fee transaction will be created that replaces the
|
||||
//lower fee transaction through the Replace-By-Fee (RBF) policy. If it
|
||||
//
|
||||
//This RPC also serves useful when wanting to perform a Child-Pays-For-Parent
|
||||
//(CPFP), where the child transaction pays for its parent's fee. This can be
|
||||
//done by specifying an outpoint within the low fee transaction that is under
|
||||
//the control of the wallet.
|
||||
//
|
||||
//The fee preference can be expressed either as a specific fee rate or a delta
|
||||
//of blocks in which the output should be swept on-chain within. If a fee
|
||||
//preference is not explicitly specified, then an error is returned.
|
||||
//
|
||||
//Note that this RPC currently doesn't perform any validation checks on the
|
||||
//fee preference being provided. For now, the responsibility of ensuring that
|
||||
//the new fee preference is sufficient is delegated to the user.
|
||||
BumpFee(ctx context.Context, in *BumpFeeRequest, opts ...grpc.CallOption) (*BumpFeeResponse, error)
|
||||
}
|
||||
|
||||
type walletKitClient struct {
|
||||
@ -879,6 +1002,15 @@ func (c *walletKitClient) PendingSweeps(ctx context.Context, in *PendingSweepsRe
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *walletKitClient) BumpFee(ctx context.Context, in *BumpFeeRequest, opts ...grpc.CallOption) (*BumpFeeResponse, error) {
|
||||
out := new(BumpFeeResponse)
|
||||
err := c.cc.Invoke(ctx, "/walletrpc.WalletKit/BumpFee", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// WalletKitServer is the server API for WalletKit service.
|
||||
type WalletKitServer interface {
|
||||
//*
|
||||
@ -919,6 +1051,33 @@ type WalletKitServer interface {
|
||||
//remain supported. This is an advanced API that depends on the internals of
|
||||
//the UtxoSweeper, so things may change.
|
||||
PendingSweeps(context.Context, *PendingSweepsRequest) (*PendingSweepsResponse, error)
|
||||
//
|
||||
//Bump the fee of an arbitrary input within a transaction. This RPC takes a
|
||||
//different approach than bitcoind's bumpfee command. lnd has a central
|
||||
//batching engine in which inputs with similar fee rates are batched together
|
||||
//to save on transaction fees. Due to this, we cannot rely on bumping the fee
|
||||
//on a specific transaction, since transactions can change at any point with
|
||||
//the addition of new inputs. The list of inputs that currently exist within
|
||||
//lnd's central batching engine can be retrieved through the PendingSweeps
|
||||
//RPC.
|
||||
//
|
||||
//When bumping the fee of an input that currently exists within lnd's central
|
||||
//batching engine, a higher fee transaction will be created that replaces the
|
||||
//lower fee transaction through the Replace-By-Fee (RBF) policy. If it
|
||||
//
|
||||
//This RPC also serves useful when wanting to perform a Child-Pays-For-Parent
|
||||
//(CPFP), where the child transaction pays for its parent's fee. This can be
|
||||
//done by specifying an outpoint within the low fee transaction that is under
|
||||
//the control of the wallet.
|
||||
//
|
||||
//The fee preference can be expressed either as a specific fee rate or a delta
|
||||
//of blocks in which the output should be swept on-chain within. If a fee
|
||||
//preference is not explicitly specified, then an error is returned.
|
||||
//
|
||||
//Note that this RPC currently doesn't perform any validation checks on the
|
||||
//fee preference being provided. For now, the responsibility of ensuring that
|
||||
//the new fee preference is sufficient is delegated to the user.
|
||||
BumpFee(context.Context, *BumpFeeRequest) (*BumpFeeResponse, error)
|
||||
}
|
||||
|
||||
func RegisterWalletKitServer(s *grpc.Server, srv WalletKitServer) {
|
||||
@ -1051,6 +1210,24 @@ func _WalletKit_PendingSweeps_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _WalletKit_BumpFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BumpFeeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WalletKitServer).BumpFee(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/walletrpc.WalletKit/BumpFee",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WalletKitServer).BumpFee(ctx, req.(*BumpFeeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _WalletKit_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "walletrpc.WalletKit",
|
||||
HandlerType: (*WalletKitServer)(nil),
|
||||
@ -1083,6 +1260,10 @@ var _WalletKit_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "PendingSweeps",
|
||||
Handler: _WalletKit_PendingSweeps_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BumpFee",
|
||||
Handler: _WalletKit_BumpFee_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "walletrpc/walletkit.proto",
|
||||
|
@ -203,6 +203,23 @@ message PendingSweepsResponse {
|
||||
repeated PendingSweep pending_sweeps = 1 [json_name = "pending_sweeps"];
|
||||
}
|
||||
|
||||
message BumpFeeRequest {
|
||||
// The input we're attempting to bump the fee of.
|
||||
lnrpc.OutPoint outpoint = 1 [json_name = "outpoint"];
|
||||
|
||||
// The target number of blocks that the input should be spent within.
|
||||
uint32 target_conf = 2 [json_name = "target_conf"];
|
||||
|
||||
/*
|
||||
The fee rate, expressed in sat/byte, that should be used to spend the input
|
||||
with.
|
||||
*/
|
||||
uint32 sat_per_byte = 3 [json_name = "sat_per_byte"];
|
||||
}
|
||||
|
||||
message BumpFeeResponse {
|
||||
}
|
||||
|
||||
service WalletKit {
|
||||
/**
|
||||
DeriveNextKey attempts to derive the *next* key within the key family
|
||||
@ -255,4 +272,33 @@ service WalletKit {
|
||||
the UtxoSweeper, so things may change.
|
||||
*/
|
||||
rpc PendingSweeps(PendingSweepsRequest) returns (PendingSweepsResponse);
|
||||
|
||||
/*
|
||||
Bump the fee of an arbitrary input within a transaction. This RPC takes a
|
||||
different approach than bitcoind's bumpfee command. lnd has a central
|
||||
batching engine in which inputs with similar fee rates are batched together
|
||||
to save on transaction fees. Due to this, we cannot rely on bumping the fee
|
||||
on a specific transaction, since transactions can change at any point with
|
||||
the addition of new inputs. The list of inputs that currently exist within
|
||||
lnd's central batching engine can be retrieved through the PendingSweeps
|
||||
RPC.
|
||||
|
||||
When bumping the fee of an input that currently exists within lnd's central
|
||||
batching engine, a higher fee transaction will be created that replaces the
|
||||
lower fee transaction through the Replace-By-Fee (RBF) policy. If it
|
||||
|
||||
This RPC also serves useful when wanting to perform a Child-Pays-For-Parent
|
||||
(CPFP), where the child transaction pays for its parent's fee. This can be
|
||||
done by specifying an outpoint within the low fee transaction that is under
|
||||
the control of the wallet.
|
||||
|
||||
The fee preference can be expressed either as a specific fee rate or a delta
|
||||
of blocks in which the output should be swept on-chain within. If a fee
|
||||
preference is not explicitly specified, then an error is returned.
|
||||
|
||||
Note that this RPC currently doesn't perform any validation checks on the
|
||||
fee preference being provided. For now, the responsibility of ensuring that
|
||||
the new fee preference is sufficient is delegated to the user.
|
||||
*/
|
||||
rpc BumpFee(BumpFeeRequest) returns (BumpFeeResponse);
|
||||
}
|
||||
|
@ -9,12 +9,15 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/sweep"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"gopkg.in/macaroon-bakery.v2/bakery"
|
||||
@ -79,6 +82,10 @@ var (
|
||||
Entity: "onchain",
|
||||
Action: "read",
|
||||
}},
|
||||
"/walletrpc.WalletKit/BumpFee": {{
|
||||
Entity: "onchain",
|
||||
Action: "write",
|
||||
}},
|
||||
}
|
||||
|
||||
// DefaultWalletKitMacFilename is the default name of the wallet kit
|
||||
@ -409,3 +416,106 @@ func (w *WalletKit) PendingSweeps(ctx context.Context,
|
||||
PendingSweeps: rpcPendingSweeps,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// unmarshallOutPoint converts an outpoint from its lnrpc type to its canonical
|
||||
// type.
|
||||
func unmarshallOutPoint(op *lnrpc.OutPoint) (*wire.OutPoint, error) {
|
||||
var hash chainhash.Hash
|
||||
switch {
|
||||
case len(op.TxidBytes) == 0 && len(op.TxidStr) == 0:
|
||||
fallthrough
|
||||
|
||||
case len(op.TxidBytes) != 0 && len(op.TxidStr) != 0:
|
||||
return nil, fmt.Errorf("either TxidBytes or TxidStr must be " +
|
||||
"specified, but not both")
|
||||
|
||||
// The hash was provided as raw bytes.
|
||||
case len(op.TxidBytes) != 0:
|
||||
copy(hash[:], op.TxidBytes)
|
||||
|
||||
// The hash was provided as a hex-encoded string.
|
||||
case len(op.TxidStr) != 0:
|
||||
h, err := chainhash.NewHashFromStr(op.TxidStr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
hash = *h
|
||||
}
|
||||
|
||||
return &wire.OutPoint{
|
||||
Hash: hash,
|
||||
Index: op.OutputIndex,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// BumpFee allows bumping the fee rate of an arbitrary input. A fee preference
|
||||
// can be expressed either as a specific fee rate or a delta of blocks in which
|
||||
// the output should be swept on-chain within. If a fee preference is not
|
||||
// explicitly specified, then an error is returned. The status of the input
|
||||
// sweep can be checked through the PendingSweeps RPC.
|
||||
func (w *WalletKit) BumpFee(ctx context.Context,
|
||||
in *BumpFeeRequest) (*BumpFeeResponse, error) {
|
||||
|
||||
// Parse the outpoint from the request.
|
||||
op, err := unmarshallOutPoint(in.Outpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Construct the request's fee preference.
|
||||
satPerKw := lnwallet.SatPerKVByte(in.SatPerByte * 1000).FeePerKWeight()
|
||||
feePreference := sweep.FeePreference{
|
||||
ConfTarget: uint32(in.TargetConf),
|
||||
FeeRate: satPerKw,
|
||||
}
|
||||
|
||||
// We'll attempt to bump the fee of the input through the UtxoSweeper.
|
||||
// If it is currently attempting to sweep the input, then it'll simply
|
||||
// bump its fee, which will result in a replacement transaction (RBF)
|
||||
// being broadcast. If it is not aware of the input however,
|
||||
// lnwallet.ErrNotMine is returned.
|
||||
_, err = w.cfg.Sweeper.BumpFee(*op, feePreference)
|
||||
switch err {
|
||||
case nil:
|
||||
return &BumpFeeResponse{}, nil
|
||||
case lnwallet.ErrNotMine:
|
||||
break
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Since we're unable to perform a bump through RBF, we'll assume the
|
||||
// user is attempting to bump an unconfirmed transaction's fee rate by
|
||||
// sweeping an output within it under control of the wallet with a
|
||||
// higher fee rate, essentially performing a Child-Pays-For-Parent
|
||||
// (CPFP).
|
||||
//
|
||||
// We'll gather all of the information required by the UtxoSweeper in
|
||||
// order to sweep the output.
|
||||
txOut, err := w.cfg.Wallet.FetchInputInfo(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var witnessType input.WitnessType
|
||||
switch {
|
||||
case txscript.IsPayToWitnessPubKeyHash(txOut.PkScript):
|
||||
witnessType = input.WitnessKeyHash
|
||||
case txscript.IsPayToScriptHash(txOut.PkScript):
|
||||
witnessType = input.NestedWitnessKeyHash
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown input witness %v", op)
|
||||
}
|
||||
|
||||
signDesc := &input.SignDescriptor{
|
||||
Output: txOut,
|
||||
HashType: txscript.SigHashAll,
|
||||
}
|
||||
|
||||
input := input.NewBaseInput(op, witnessType, signDesc, 0)
|
||||
if _, err = w.cfg.Sweeper.SweepInput(input, feePreference); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &BumpFeeResponse{}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user