Merge pull request #4139 from carlaKC/lnrpc-listsweeps
lnrpc: add block height params to GetTransactions and add ListSweeps
This commit is contained in:
20 files changed
+1515
-836
No files matched your search
+40
-6
@@ -2295,11 +2295,37 @@ func debugLevel(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var listChainTxnsCommand = cli.Command{
|
var listChainTxnsCommand = cli.Command{
|
||||||
Name: "listchaintxns",
|
Name: "listchaintxns",
|
||||||
Category: "On-chain",
|
Category: "On-chain",
|
||||||
Usage: "List transactions from the wallet.",
|
Usage: "List transactions from the wallet.",
|
||||||
Description: "List all transactions an address of the wallet was involved in.",
|
Flags: []cli.Flag{
|
||||||
Action: actionDecorator(listChainTxns),
|
cli.Int64Flag{
|
||||||
|
Name: "start_height",
|
||||||
|
Usage: "the block height from which to list " +
|
||||||
|
"transactions, inclusive",
|
||||||
|
},
|
||||||
|
cli.Int64Flag{
|
||||||
|
Name: "end_height",
|
||||||
|
Usage: "the block height until which to list " +
|
||||||
|
"transactions, inclusive, to get transactions " +
|
||||||
|
"until the chain tip, including unconfirmed, " +
|
||||||
|
"set this value to -1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Description: `
|
||||||
|
List all transactions an address of the wallet was involved in.
|
||||||
|
|
||||||
|
This call will return a list of wallet related transactions that paid
|
||||||
|
to an address our wallet controls, or spent utxos that we held. The
|
||||||
|
start_height and end_height flags can be used to specify an inclusive
|
||||||
|
block range over which to query for transactions. If the end_height is
|
||||||
|
less than the start_height, transactions will be queried in reverse.
|
||||||
|
To get all transactions until the chain tip, including unconfirmed
|
||||||
|
transactions (identifiable with BlockHeight=0), set end_height to -1.
|
||||||
|
By default, this call will get all transactions our wallet was involved
|
||||||
|
in, including unconfirmed transactions.
|
||||||
|
`,
|
||||||
|
Action: actionDecorator(listChainTxns),
|
||||||
}
|
}
|
||||||
|
|
||||||
func listChainTxns(ctx *cli.Context) error {
|
func listChainTxns(ctx *cli.Context) error {
|
||||||
@@ -2307,8 +2333,16 @@ func listChainTxns(ctx *cli.Context) error {
|
|||||||
client, cleanUp := getClient(ctx)
|
client, cleanUp := getClient(ctx)
|
||||||
defer cleanUp()
|
defer cleanUp()
|
||||||
|
|
||||||
resp, err := client.GetTransactions(ctxb, &lnrpc.GetTransactionsRequest{})
|
req := &lnrpc.GetTransactionsRequest{}
|
||||||
|
|
||||||
|
if ctx.IsSet("start_height") {
|
||||||
|
req.StartHeight = int32(ctx.Int64("start_height"))
|
||||||
|
}
|
||||||
|
if ctx.IsSet("end_height") {
|
||||||
|
req.EndHeight = int32(ctx.Int64("end_height"))
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetTransactions(ctxb, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ func walletCommands() []cli.Command {
|
|||||||
pendingSweepsCommand,
|
pendingSweepsCommand,
|
||||||
bumpFeeCommand,
|
bumpFeeCommand,
|
||||||
bumpCloseFeeCommand,
|
bumpCloseFeeCommand,
|
||||||
|
listSweepsCommand,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -300,3 +301,42 @@ func getWaitingCloseCommitments(client lnrpc.LightningClient,
|
|||||||
|
|
||||||
return nil, errors.New("channel not found")
|
return nil, errors.New("channel not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var listSweepsCommand = cli.Command{
|
||||||
|
Name: "listsweeps",
|
||||||
|
Category: "On-chain",
|
||||||
|
Usage: "Lists all sweeps that have been published by our node.",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "verbose",
|
||||||
|
Usage: "lookup full transaction",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Description: `
|
||||||
|
Get a list of the hex-encoded transaction ids of every sweep that our
|
||||||
|
node has published. Note that these sweeps may not be confirmed on chain
|
||||||
|
yet, as we store them on transaction broadcast, not confirmation.
|
||||||
|
|
||||||
|
If the verbose flag is set, the full set of transactions will be
|
||||||
|
returned, otherwise only the sweep transaction ids will be returned.
|
||||||
|
`,
|
||||||
|
Action: actionDecorator(listSweeps),
|
||||||
|
}
|
||||||
|
|
||||||
|
func listSweeps(ctx *cli.Context) error {
|
||||||
|
client, cleanUp := getWalletClient(ctx)
|
||||||
|
defer cleanUp()
|
||||||
|
|
||||||
|
resp, err := client.ListSweeps(
|
||||||
|
context.Background(), &walletrpc.ListSweepsRequest{
|
||||||
|
Verbose: ctx.IsSet("verbose"),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
printJSON(resp)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
+733
-707
File diff suppressed because it is too large.
Load diff
@@ -114,10 +114,18 @@ func request_Lightning_ChannelBalance_0(ctx context.Context, marshaler runtime.M
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
filter_Lightning_GetTransactions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||||
|
)
|
||||||
|
|
||||||
func request_Lightning_GetTransactions_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_Lightning_GetTransactions_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq GetTransactionsRequest
|
var protoReq GetTransactionsRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Lightning_GetTransactions_0); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
msg, err := client.GetTransactions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
msg, err := client.GetTransactions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
return msg, metadata, err
|
return msg, metadata, err
|
||||||
|
|
||||||
|
|||||||
@@ -897,7 +897,22 @@ message Transaction {
|
|||||||
string raw_tx_hex = 9;
|
string raw_tx_hex = 9;
|
||||||
}
|
}
|
||||||
message GetTransactionsRequest {
|
message GetTransactionsRequest {
|
||||||
|
/*
|
||||||
|
The height from which to list transactions, inclusive. If this value is
|
||||||
|
greater than end_height, transactions will be read in reverse.
|
||||||
|
*/
|
||||||
|
int32 start_height = 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
The height until which to list transactions, inclusive. To include
|
||||||
|
unconfirmed transactions, this value should be set to -1, which will
|
||||||
|
return transactions from start_height until the current chain tip and
|
||||||
|
unconfirmed transactions. If no end_height is provided, the call will
|
||||||
|
default to this option.
|
||||||
|
*/
|
||||||
|
int32 end_height = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message TransactionDetails {
|
message TransactionDetails {
|
||||||
/// The list of transactions relevant to the wallet.
|
/// The list of transactions relevant to the wallet.
|
||||||
repeated Transaction transactions = 1;
|
repeated Transaction transactions = 1;
|
||||||
|
|||||||
@@ -1377,6 +1377,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "start_height",
|
||||||
|
"description": "The height from which to list transactions, inclusive. If this value is\ngreater than end_height, transactions will be read in reverse.",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "end_height",
|
||||||
|
"description": "The height until which to list transactions, inclusive. To include\nunconfirmed transactions, this value should be set to -1, which will\nreturn transactions from start_height until the current chain tip and\nunconfirmed transactions. If no end_height is provided, the call will\ndefault to this option.",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Lightning"
|
"Lightning"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package lnrpc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/hex"
|
||||||
|
"sort"
|
||||||
|
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RPCTransactionDetails returns a set of rpc transaction details.
|
||||||
|
func RPCTransactionDetails(txns []*lnwallet.TransactionDetail) *TransactionDetails {
|
||||||
|
txDetails := &TransactionDetails{
|
||||||
|
Transactions: make([]*Transaction, len(txns)),
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, tx := range txns {
|
||||||
|
var destAddresses []string
|
||||||
|
for _, destAddress := range tx.DestAddresses {
|
||||||
|
destAddresses = append(destAddresses, destAddress.EncodeAddress())
|
||||||
|
}
|
||||||
|
|
||||||
|
// We also get unconfirmed transactions, so BlockHash can be
|
||||||
|
// nil.
|
||||||
|
blockHash := ""
|
||||||
|
if tx.BlockHash != nil {
|
||||||
|
blockHash = tx.BlockHash.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
txDetails.Transactions[i] = &Transaction{
|
||||||
|
TxHash: tx.Hash.String(),
|
||||||
|
Amount: int64(tx.Value),
|
||||||
|
NumConfirmations: tx.NumConfirmations,
|
||||||
|
BlockHash: blockHash,
|
||||||
|
BlockHeight: tx.BlockHeight,
|
||||||
|
TimeStamp: tx.Timestamp,
|
||||||
|
TotalFees: tx.TotalFees,
|
||||||
|
DestAddresses: destAddresses,
|
||||||
|
RawTxHex: hex.EncodeToString(tx.RawTx),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort transactions by number of confirmations rather than height so
|
||||||
|
// that unconfirmed transactions (height =0; confirmations =-1) will
|
||||||
|
// follow the most recently set of confirmed transactions. If we sort
|
||||||
|
// by height, unconfirmed transactions will follow our oldest
|
||||||
|
// transactions, because they have lower block heights.
|
||||||
|
sort.Slice(txDetails.Transactions, func(i, j int) bool {
|
||||||
|
return txDetails.Transactions[i].NumConfirmations <
|
||||||
|
txDetails.Transactions[j].NumConfirmations
|
||||||
|
})
|
||||||
|
|
||||||
|
return txDetails
|
||||||
|
}
|
||||||
+284
-67
@@ -813,6 +813,171 @@ func (m *BumpFeeResponse) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_BumpFeeResponse proto.InternalMessageInfo
|
var xxx_messageInfo_BumpFeeResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type ListSweepsRequest struct {
|
||||||
|
//
|
||||||
|
//Retrieve the full sweep transaction details. If false, only the sweep txids
|
||||||
|
//will be returned.
|
||||||
|
Verbose bool `protobuf:"varint,1,opt,name=verbose,proto3" json:"verbose,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListSweepsRequest) Reset() { *m = ListSweepsRequest{} }
|
||||||
|
func (m *ListSweepsRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ListSweepsRequest) ProtoMessage() {}
|
||||||
|
func (*ListSweepsRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_6cc6942ac78249e5, []int{14}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListSweepsRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ListSweepsRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ListSweepsRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ListSweepsRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ListSweepsRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ListSweepsRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ListSweepsRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ListSweepsRequest) GetVerbose() bool {
|
||||||
|
if m != nil {
|
||||||
|
return m.Verbose
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListSweepsResponse struct {
|
||||||
|
// Types that are valid to be assigned to Sweeps:
|
||||||
|
// *ListSweepsResponse_TransactionDetails
|
||||||
|
// *ListSweepsResponse_TransactionIds
|
||||||
|
Sweeps isListSweepsResponse_Sweeps `protobuf_oneof:"sweeps"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListSweepsResponse) Reset() { *m = ListSweepsResponse{} }
|
||||||
|
func (m *ListSweepsResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ListSweepsResponse) ProtoMessage() {}
|
||||||
|
func (*ListSweepsResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_6cc6942ac78249e5, []int{15}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListSweepsResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ListSweepsResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ListSweepsResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ListSweepsResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ListSweepsResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ListSweepsResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ListSweepsResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type isListSweepsResponse_Sweeps interface {
|
||||||
|
isListSweepsResponse_Sweeps()
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListSweepsResponse_TransactionDetails struct {
|
||||||
|
TransactionDetails *lnrpc.TransactionDetails `protobuf:"bytes,1,opt,name=transaction_details,json=transactionDetails,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListSweepsResponse_TransactionIds struct {
|
||||||
|
TransactionIds *ListSweepsResponse_TransactionIDs `protobuf:"bytes,2,opt,name=transaction_ids,json=transactionIds,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ListSweepsResponse_TransactionDetails) isListSweepsResponse_Sweeps() {}
|
||||||
|
|
||||||
|
func (*ListSweepsResponse_TransactionIds) isListSweepsResponse_Sweeps() {}
|
||||||
|
|
||||||
|
func (m *ListSweepsResponse) GetSweeps() isListSweepsResponse_Sweeps {
|
||||||
|
if m != nil {
|
||||||
|
return m.Sweeps
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListSweepsResponse) GetTransactionDetails() *lnrpc.TransactionDetails {
|
||||||
|
if x, ok := m.GetSweeps().(*ListSweepsResponse_TransactionDetails); ok {
|
||||||
|
return x.TransactionDetails
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListSweepsResponse) GetTransactionIds() *ListSweepsResponse_TransactionIDs {
|
||||||
|
if x, ok := m.GetSweeps().(*ListSweepsResponse_TransactionIds); ok {
|
||||||
|
return x.TransactionIds
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX_OneofWrappers is for the internal use of the proto package.
|
||||||
|
func (*ListSweepsResponse) XXX_OneofWrappers() []interface{} {
|
||||||
|
return []interface{}{
|
||||||
|
(*ListSweepsResponse_TransactionDetails)(nil),
|
||||||
|
(*ListSweepsResponse_TransactionIds)(nil),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListSweepsResponse_TransactionIDs struct {
|
||||||
|
//
|
||||||
|
//Reversed, hex-encoded string representing the transaction ids of the
|
||||||
|
//sweeps that our node has broadcast. Note that these transactions may
|
||||||
|
//not have confirmed yet, we record sweeps on broadcast, not confirmation.
|
||||||
|
TransactionIds []string `protobuf:"bytes,1,rep,name=transaction_ids,json=transactionIds,proto3" json:"transaction_ids,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListSweepsResponse_TransactionIDs) Reset() { *m = ListSweepsResponse_TransactionIDs{} }
|
||||||
|
func (m *ListSweepsResponse_TransactionIDs) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ListSweepsResponse_TransactionIDs) ProtoMessage() {}
|
||||||
|
func (*ListSweepsResponse_TransactionIDs) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_6cc6942ac78249e5, []int{15, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListSweepsResponse_TransactionIDs) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ListSweepsResponse_TransactionIDs.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsResponse_TransactionIDs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ListSweepsResponse_TransactionIDs.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsResponse_TransactionIDs) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ListSweepsResponse_TransactionIDs.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsResponse_TransactionIDs) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ListSweepsResponse_TransactionIDs.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ListSweepsResponse_TransactionIDs) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ListSweepsResponse_TransactionIDs.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ListSweepsResponse_TransactionIDs proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ListSweepsResponse_TransactionIDs) GetTransactionIds() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.TransactionIds
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterEnum("walletrpc.WitnessType", WitnessType_name, WitnessType_value)
|
proto.RegisterEnum("walletrpc.WitnessType", WitnessType_name, WitnessType_value)
|
||||||
proto.RegisterType((*KeyReq)(nil), "walletrpc.KeyReq")
|
proto.RegisterType((*KeyReq)(nil), "walletrpc.KeyReq")
|
||||||
@@ -829,78 +994,89 @@ func init() {
|
|||||||
proto.RegisterType((*PendingSweepsResponse)(nil), "walletrpc.PendingSweepsResponse")
|
proto.RegisterType((*PendingSweepsResponse)(nil), "walletrpc.PendingSweepsResponse")
|
||||||
proto.RegisterType((*BumpFeeRequest)(nil), "walletrpc.BumpFeeRequest")
|
proto.RegisterType((*BumpFeeRequest)(nil), "walletrpc.BumpFeeRequest")
|
||||||
proto.RegisterType((*BumpFeeResponse)(nil), "walletrpc.BumpFeeResponse")
|
proto.RegisterType((*BumpFeeResponse)(nil), "walletrpc.BumpFeeResponse")
|
||||||
|
proto.RegisterType((*ListSweepsRequest)(nil), "walletrpc.ListSweepsRequest")
|
||||||
|
proto.RegisterType((*ListSweepsResponse)(nil), "walletrpc.ListSweepsResponse")
|
||||||
|
proto.RegisterType((*ListSweepsResponse_TransactionIDs)(nil), "walletrpc.ListSweepsResponse.TransactionIDs")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("walletrpc/walletkit.proto", fileDescriptor_6cc6942ac78249e5) }
|
func init() { proto.RegisterFile("walletrpc/walletkit.proto", fileDescriptor_6cc6942ac78249e5) }
|
||||||
|
|
||||||
var fileDescriptor_6cc6942ac78249e5 = []byte{
|
var fileDescriptor_6cc6942ac78249e5 = []byte{
|
||||||
// 1055 bytes of a gzipped FileDescriptorProto
|
// 1180 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x6b, 0x6f, 0xe2, 0x46,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x6d, 0x6f, 0xe2, 0x46,
|
||||||
0x14, 0x2d, 0x21, 0x21, 0x70, 0x81, 0xc4, 0x19, 0xf2, 0xf0, 0xb2, 0xd9, 0x86, 0xba, 0x0f, 0xa1,
|
0x10, 0x3e, 0x42, 0x42, 0x60, 0x78, 0x09, 0x59, 0xf2, 0xe2, 0xe3, 0x72, 0x0d, 0x75, 0xdf, 0xa2,
|
||||||
0x3e, 0x40, 0x4d, 0xd4, 0xaa, 0x0f, 0xa9, 0x2a, 0x21, 0x8e, 0x88, 0x20, 0x98, 0xda, 0xce, 0x46,
|
0xf6, 0x8e, 0xa8, 0x39, 0xb5, 0xea, 0xb5, 0x52, 0xd5, 0x04, 0x1c, 0x11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0xca, 0xd7, 0x50, 0x49, 0xb9,
|
0xd9, 0x93, 0xe2, 0x59, 0xa5, 0x19, 0xe5, 0xaf, 0x69, 0xcc, 0xd5, 0x29, 0xd3, 0x62, 0x58, 0x7e,
|
||||||
0x47, 0x99, 0x1d, 0x41, 0x8e, 0x5a, 0x73, 0xcc, 0x92, 0x33, 0x50, 0x6b, 0x6e, 0x2e, 0x94, 0xef,
|
0x01, 0xb5, 0x94, 0x7a, 0x14, 0xd9, 0x3e, 0xe4, 0xa8, 0x39, 0xc3, 0x2c, 0x79, 0x03, 0x35, 0x67,
|
||||||
0x00, 0xa9, 0x3e, 0xb3, 0xa7, 0x16, 0x23, 0xd7, 0x84, 0xc4, 0xb9, 0x9c, 0x41, 0x71, 0xe8, 0x3a,
|
0xc6, 0x5c, 0xfe, 0x01, 0x90, 0xe2, 0x33, 0x7b, 0x62, 0x32, 0x72, 0x49, 0x48, 0x1c, 0xcb, 0x31,
|
||||||
0x8f, 0x98, 0x59, 0x74, 0x4c, 0xe2, 0xb2, 0x43, 0x00, 0x99, 0x1c, 0x51, 0x2e, 0xa0, 0x92, 0x0a,
|
0x14, 0x87, 0xae, 0x73, 0x87, 0x99, 0x49, 0x47, 0x24, 0x4e, 0x3b, 0x04, 0x26, 0x83, 0x5b, 0xe4,
|
||||||
0x8b, 0x5e, 0xf2, 0x9f, 0x67, 0x50, 0x3e, 0x64, 0xa1, 0x34, 0x20, 0xce, 0xc8, 0x76, 0xc6, 0xc6,
|
0x57, 0x50, 0x4b, 0xb9, 0x45, 0x97, 0x7c, 0xf2, 0x0d, 0xf2, 0xc7, 0x2c, 0x94, 0x6e, 0x88, 0x63,
|
||||||
0x9c, 0x10, 0x0f, 0x7d, 0x05, 0xf9, 0x20, 0x6b, 0x37, 0xbe, 0xda, 0xe2, 0xf9, 0x7e, 0x63, 0xc2,
|
0xd9, 0xce, 0x48, 0x9f, 0x11, 0xe2, 0xa1, 0xef, 0x20, 0x1f, 0x44, 0xed, 0xc6, 0xa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 0x21, 0x6c, 0xe6, 0xd2, 0x87, 0xd3,
|
||||||
|
0xb1, 0x63, 0x9d, 0xf2, 0xa9, 0x78, 0x9a, 0xe8, 0x0c, 0x72, 0xfc, 0xdf, 0xc4, 0x57, 0xff, 0x06,
|
||||||
|
0x00, 0x00, 0xff, 0xff, 0xe6, 0xc9, 0x1c, 0x56, 0x6f, 0x0a, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@@ -980,6 +1156,11 @@ type WalletKitClient interface {
|
|||||||
//fee preference being provided. For now, the responsibility of ensuring that
|
//fee preference being provided. For now, the responsibility of ensuring that
|
||||||
//the new fee preference is sufficient is delegated to the user.
|
//the new fee preference is sufficient is delegated to the user.
|
||||||
BumpFee(ctx context.Context, in *BumpFeeRequest, opts ...grpc.CallOption) (*BumpFeeResponse, error)
|
BumpFee(ctx context.Context, in *BumpFeeRequest, opts ...grpc.CallOption) (*BumpFeeResponse, error)
|
||||||
|
//*
|
||||||
|
//ListSweeps returns a list of the sweep transactions our node has produced.
|
||||||
|
//Note that these sweeps may not be confirmed yet, as we record sweeps on
|
||||||
|
//broadcast, not confirmation.
|
||||||
|
ListSweeps(ctx context.Context, in *ListSweepsRequest, opts ...grpc.CallOption) (*ListSweepsResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type walletKitClient struct {
|
type walletKitClient struct {
|
||||||
@@ -1062,6 +1243,15 @@ func (c *walletKitClient) BumpFee(ctx context.Context, in *BumpFeeRequest, opts
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *walletKitClient) ListSweeps(ctx context.Context, in *ListSweepsRequest, opts ...grpc.CallOption) (*ListSweepsResponse, error) {
|
||||||
|
out := new(ListSweepsResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/walletrpc.WalletKit/ListSweeps", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// WalletKitServer is the server API for WalletKit service.
|
// WalletKitServer is the server API for WalletKit service.
|
||||||
type WalletKitServer interface {
|
type WalletKitServer interface {
|
||||||
//*
|
//*
|
||||||
@@ -1129,6 +1319,11 @@ type WalletKitServer interface {
|
|||||||
//fee preference being provided. For now, the responsibility of ensuring that
|
//fee preference being provided. For now, the responsibility of ensuring that
|
||||||
//the new fee preference is sufficient is delegated to the user.
|
//the new fee preference is sufficient is delegated to the user.
|
||||||
BumpFee(context.Context, *BumpFeeRequest) (*BumpFeeResponse, error)
|
BumpFee(context.Context, *BumpFeeRequest) (*BumpFeeResponse, error)
|
||||||
|
//*
|
||||||
|
//ListSweeps returns a list of the sweep transactions our node has produced.
|
||||||
|
//Note that these sweeps may not be confirmed yet, as we record sweeps on
|
||||||
|
//broadcast, not confirmation.
|
||||||
|
ListSweeps(context.Context, *ListSweepsRequest) (*ListSweepsResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterWalletKitServer(s *grpc.Server, srv WalletKitServer) {
|
func RegisterWalletKitServer(s *grpc.Server, srv WalletKitServer) {
|
||||||
@@ -1279,6 +1474,24 @@ func _WalletKit_BumpFee_Handler(srv interface{}, ctx context.Context, dec func(i
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _WalletKit_ListSweeps_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(ListSweepsRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(WalletKitServer).ListSweeps(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/walletrpc.WalletKit/ListSweeps",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(WalletKitServer).ListSweeps(ctx, req.(*ListSweepsRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
var _WalletKit_serviceDesc = grpc.ServiceDesc{
|
var _WalletKit_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "walletrpc.WalletKit",
|
ServiceName: "walletrpc.WalletKit",
|
||||||
HandlerType: (*WalletKitServer)(nil),
|
HandlerType: (*WalletKitServer)(nil),
|
||||||
@@ -1315,6 +1528,10 @@ var _WalletKit_serviceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "BumpFee",
|
MethodName: "BumpFee",
|
||||||
Handler: _WalletKit_BumpFee_Handler,
|
Handler: _WalletKit_BumpFee_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ListSweeps",
|
||||||
|
Handler: _WalletKit_ListSweeps_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "walletrpc/walletkit.proto",
|
Metadata: "walletrpc/walletkit.proto",
|
||||||
|
|||||||
@@ -244,6 +244,31 @@ message BumpFeeRequest {
|
|||||||
message BumpFeeResponse {
|
message BumpFeeResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message ListSweepsRequest {
|
||||||
|
/*
|
||||||
|
Retrieve the full sweep transaction details. If false, only the sweep txids
|
||||||
|
will be returned.
|
||||||
|
*/
|
||||||
|
bool verbose = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListSweepsResponse {
|
||||||
|
message TransactionIDs {
|
||||||
|
/*
|
||||||
|
Reversed, hex-encoded string representing the transaction ids of the
|
||||||
|
sweeps that our node has broadcast. Note that these transactions may
|
||||||
|
not have confirmed yet, we record sweeps on broadcast, not confirmation.
|
||||||
|
*/
|
||||||
|
repeated string transaction_ids = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
oneof sweeps {
|
||||||
|
lnrpc.TransactionDetails transaction_details = 1;
|
||||||
|
TransactionIDs transaction_ids = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
service WalletKit {
|
service WalletKit {
|
||||||
/**
|
/**
|
||||||
DeriveNextKey attempts to derive the *next* key within the key family
|
DeriveNextKey attempts to derive the *next* key within the key family
|
||||||
@@ -325,4 +350,13 @@ service WalletKit {
|
|||||||
the new fee preference is sufficient is delegated to the user.
|
the new fee preference is sufficient is delegated to the user.
|
||||||
*/
|
*/
|
||||||
rpc BumpFee (BumpFeeRequest) returns (BumpFeeResponse);
|
rpc BumpFee (BumpFeeRequest) returns (BumpFeeResponse);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
ListSweeps returns a list of the sweep transactions our node has produced.
|
||||||
|
Note that these sweeps may not be confirmed yet, as we record sweeps on
|
||||||
|
broadcast, not confirmation.
|
||||||
|
*/
|
||||||
|
rpc ListSweeps (ListSweepsRequest) returns (ListSweepsResponse) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||||
"github.com/lightningnetwork/lnd/sweep"
|
"github.com/lightningnetwork/lnd/sweep"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@@ -88,6 +89,10 @@ var (
|
|||||||
Entity: "onchain",
|
Entity: "onchain",
|
||||||
Action: "write",
|
Action: "write",
|
||||||
}},
|
}},
|
||||||
|
"/walletrpc.WalletKit/ListSweeps": {{
|
||||||
|
Entity: "onchain",
|
||||||
|
Action: "read",
|
||||||
|
}},
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultWalletKitMacFilename is the default name of the wallet kit
|
// DefaultWalletKitMacFilename is the default name of the wallet kit
|
||||||
@@ -555,3 +560,67 @@ func (w *WalletKit) BumpFee(ctx context.Context,
|
|||||||
|
|
||||||
return &BumpFeeResponse{}, nil
|
return &BumpFeeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListSweeps returns a list of the sweeps that our node has published.
|
||||||
|
func (w *WalletKit) ListSweeps(ctx context.Context,
|
||||||
|
in *ListSweepsRequest) (*ListSweepsResponse, error) {
|
||||||
|
|
||||||
|
sweeps, err := w.cfg.Sweeper.ListSweeps()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
sweepTxns := make(map[string]bool)
|
||||||
|
|
||||||
|
txids := make([]string, len(sweeps))
|
||||||
|
for i, sweep := range sweeps {
|
||||||
|
sweepTxns[sweep.String()] = true
|
||||||
|
txids[i] = sweep.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the caller does not want verbose output, just return the set of
|
||||||
|
// sweep txids.
|
||||||
|
if !in.Verbose {
|
||||||
|
txidResp := &ListSweepsResponse_TransactionIDs{
|
||||||
|
TransactionIds: txids,
|
||||||
|
}
|
||||||
|
|
||||||
|
return &ListSweepsResponse{
|
||||||
|
Sweeps: &ListSweepsResponse_TransactionIds{
|
||||||
|
TransactionIds: txidResp,
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the caller does want full transaction lookups, query our wallet
|
||||||
|
// for all transactions, including unconfirmed transactions.
|
||||||
|
transactions, err := w.cfg.Wallet.ListTransactionDetails(
|
||||||
|
0, btcwallet.UnconfirmedHeight,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var sweepTxDetails []*lnwallet.TransactionDetail
|
||||||
|
for _, tx := range transactions {
|
||||||
|
_, ok := sweepTxns[tx.Hash.String()]
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
sweepTxDetails = append(sweepTxDetails, tx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fail if we have not retrieved all of our sweep transactions from the
|
||||||
|
// wallet.
|
||||||
|
if len(sweepTxDetails) != len(txids) {
|
||||||
|
return nil, fmt.Errorf("not all sweeps found by list "+
|
||||||
|
"transactions: %v, %v", len(sweepTxDetails), len(txids))
|
||||||
|
}
|
||||||
|
|
||||||
|
return &ListSweepsResponse{
|
||||||
|
Sweeps: &ListSweepsResponse_TransactionDetails{
|
||||||
|
TransactionDetails: lnrpc.RPCTransactionDetails(transactions),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
|
||||||
|
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc/watchtowerrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/watchtowerrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc/wtclientrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/wtclientrpc"
|
||||||
"github.com/lightningnetwork/lnd/lntest"
|
"github.com/lightningnetwork/lnd/lntest"
|
||||||
@@ -3586,6 +3587,13 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check that we can find the commitment sweep in our set of known
|
||||||
|
// sweeps.
|
||||||
|
err = findSweep(ctxb, alice, sweepingTXID)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("csv sweep not found: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Restart Alice to ensure that she resumes watching the finalized
|
// Restart Alice to ensure that she resumes watching the finalized
|
||||||
// commitment sweep txid.
|
// commitment sweep txid.
|
||||||
if err := net.RestartNode(alice, nil); err != nil {
|
if err := net.RestartNode(alice, nil); err != nil {
|
||||||
@@ -3753,7 +3761,10 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
|
|
||||||
// Retrieve each htlc timeout txn from the mempool, and ensure it is
|
// Retrieve each htlc timeout txn from the mempool, and ensure it is
|
||||||
// well-formed. This entails verifying that each only spends from
|
// well-formed. This entails verifying that each only spends from
|
||||||
// output, and that that output is from the commitment txn.
|
// output, and that that output is from the commitment txn. We do not
|
||||||
|
// the sweeper check for these timeout transactions because they are
|
||||||
|
// not swept by the sweeper; the nursery broadcasts the pre-signed
|
||||||
|
// transaction.
|
||||||
for _, htlcTxID := range htlcTxIDs {
|
for _, htlcTxID := range htlcTxIDs {
|
||||||
// Fetch the sweep transaction, all input it's spending should
|
// Fetch the sweep transaction, all input it's spending should
|
||||||
// be from the commitment transaction which was broadcast
|
// be from the commitment transaction which was broadcast
|
||||||
@@ -3904,6 +3915,12 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check that we can find the htlc sweep in our set of sweeps.
|
||||||
|
err = findSweep(ctxb, alice, htlcSweepTx.Hash())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("htlc sweep not found: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// The following restart checks to ensure that the nursery store is
|
// The following restart checks to ensure that the nursery store is
|
||||||
// storing the txid of the previously broadcast htlc sweep txn, and that
|
// storing the txid of the previously broadcast htlc sweep txn, and that
|
||||||
// it begins watching that txid after restarting.
|
// it begins watching that txid after restarting.
|
||||||
@@ -4010,6 +4027,35 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// findSweep looks up a sweep in a nodes list of broadcast sweeps.
|
||||||
|
func findSweep(ctx context.Context, node *lntest.HarnessNode,
|
||||||
|
sweep *chainhash.Hash) error {
|
||||||
|
|
||||||
|
// List all sweeps that alice's node had broadcast.
|
||||||
|
ctx, _ = context.WithTimeout(ctx, defaultTimeout)
|
||||||
|
sweepResp, err := node.WalletKitClient.ListSweeps(
|
||||||
|
ctx, &walletrpc.ListSweepsRequest{
|
||||||
|
Verbose: false,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("list sweeps error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
sweepTxIDs, ok := sweepResp.Sweeps.(*walletrpc.ListSweepsResponse_TransactionIds)
|
||||||
|
if !ok {
|
||||||
|
return errors.New("expected sweep txids in response")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that the sweep tx we have just produced is present.
|
||||||
|
for _, tx := range sweepTxIDs.TransactionIds.TransactionIds {
|
||||||
|
if tx == sweep.String() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Errorf("sweep: %v not found", sweep.String())
|
||||||
|
}
|
||||||
|
|
||||||
// assertAmountSent generates a closure which queries listchannels for sndr and
|
// assertAmountSent generates a closure which queries listchannels for sndr and
|
||||||
// rcvr, and asserts that sndr sent amt satoshis, and that rcvr received amt
|
// rcvr, and asserts that sndr sent amt satoshis, and that rcvr received amt
|
||||||
// satoshis.
|
// satoshis.
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
defaultAccount = uint32(waddrmgr.DefaultAccountNum)
|
defaultAccount = uint32(waddrmgr.DefaultAccountNum)
|
||||||
|
|
||||||
|
// UnconfirmedHeight is the special case end height that is used to
|
||||||
|
// obtain unconfirmed transactions from ListTransactionDetails.
|
||||||
|
UnconfirmedHeight int32 = -1
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -569,20 +573,22 @@ func unminedTransactionsToDetail(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ListTransactionDetails returns a list of all transactions which are
|
// ListTransactionDetails returns a list of all transactions which are
|
||||||
// relevant to the wallet.
|
// relevant to the wallet. It takes inclusive start and end height to allow
|
||||||
|
// paginated queries. Unconfirmed transactions can be included in the query
|
||||||
|
// by providing endHeight = UnconfirmedHeight (= -1).
|
||||||
//
|
//
|
||||||
// This is a part of the WalletController interface.
|
// This is a part of the WalletController interface.
|
||||||
func (b *BtcWallet) ListTransactionDetails() ([]*lnwallet.TransactionDetail, error) {
|
func (b *BtcWallet) ListTransactionDetails(startHeight,
|
||||||
|
endHeight int32) ([]*lnwallet.TransactionDetail, error) {
|
||||||
|
|
||||||
// Grab the best block the wallet knows of, we'll use this to calculate
|
// Grab the best block the wallet knows of, we'll use this to calculate
|
||||||
// # of confirmations shortly below.
|
// # of confirmations shortly below.
|
||||||
bestBlock := b.wallet.Manager.SyncedTo()
|
bestBlock := b.wallet.Manager.SyncedTo()
|
||||||
currentHeight := bestBlock.Height
|
currentHeight := bestBlock.Height
|
||||||
|
|
||||||
// We'll attempt to find all unconfirmed transactions (height of -1),
|
// We'll attempt to find all transactions from start to end height.
|
||||||
// as well as all transactions that are known to have confirmed at this
|
start := base.NewBlockIdentifierFromHeight(startHeight)
|
||||||
// height.
|
stop := base.NewBlockIdentifierFromHeight(endHeight)
|
||||||
start := base.NewBlockIdentifierFromHeight(0)
|
|
||||||
stop := base.NewBlockIdentifierFromHeight(-1)
|
|
||||||
txns, err := b.wallet.GetTransactions(start, stop, nil)
|
txns, err := b.wallet.GetTransactions(start, stop, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -199,8 +199,14 @@ type WalletController interface {
|
|||||||
ListUnspentWitness(minconfirms, maxconfirms int32) ([]*Utxo, error)
|
ListUnspentWitness(minconfirms, maxconfirms int32) ([]*Utxo, error)
|
||||||
|
|
||||||
// ListTransactionDetails returns a list of all transactions which are
|
// ListTransactionDetails returns a list of all transactions which are
|
||||||
// relevant to the wallet.
|
// relevant to the wallet over [startHeight;endHeight]. If start height
|
||||||
ListTransactionDetails() ([]*TransactionDetail, error)
|
// is greater than end height, the transactions will be retrieved in
|
||||||
|
// reverse order. To include unconfirmed transactions, endHeight should
|
||||||
|
// be set to the special value -1. This will return transactions from
|
||||||
|
// the tip of the chain until the start height (inclusive) and
|
||||||
|
// unconfirmed transactions.
|
||||||
|
ListTransactionDetails(startHeight,
|
||||||
|
endHeight int32) ([]*TransactionDetail, error)
|
||||||
|
|
||||||
// LockOutpoint marks an outpoint as locked meaning it will no longer
|
// LockOutpoint marks an outpoint as locked meaning it will no longer
|
||||||
// be deemed as eligible for coin selection. Locking outputs are
|
// be deemed as eligible for coin selection. Locking outputs are
|
||||||
|
|||||||
+62
-10
@@ -206,7 +206,7 @@ func assertTxInWallet(t *testing.T, w *lnwallet.LightningWallet,
|
|||||||
// We'll fetch all of our transaction and go through each one until
|
// We'll fetch all of our transaction and go through each one until
|
||||||
// finding the expected transaction with its expected confirmation
|
// finding the expected transaction with its expected confirmation
|
||||||
// status.
|
// status.
|
||||||
txs, err := w.ListTransactionDetails()
|
txs, err := w.ListTransactionDetails(0, btcwallet.UnconfirmedHeight)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to retrieve transactions: %v", err)
|
t.Fatalf("unable to retrieve transactions: %v", err)
|
||||||
}
|
}
|
||||||
@@ -1101,6 +1101,12 @@ func testListTransactionDetails(miner *rpctest.Harness,
|
|||||||
txids[*txid] = struct{}{}
|
txids[*txid] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the miner's current best block height before we mine blocks.
|
||||||
|
_, startHeight, err := miner.Node.GetBestBlock()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("cannot get best block: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Generate 10 blocks to mine all the transactions created above.
|
// Generate 10 blocks to mine all the transactions created above.
|
||||||
const numBlocksMined = 10
|
const numBlocksMined = 10
|
||||||
blocks, err := miner.Node.Generate(numBlocksMined)
|
blocks, err := miner.Node.Generate(numBlocksMined)
|
||||||
@@ -1108,12 +1114,22 @@ func testListTransactionDetails(miner *rpctest.Harness,
|
|||||||
t.Fatalf("unable to mine blocks: %v", err)
|
t.Fatalf("unable to mine blocks: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, fetch all the current transaction details.
|
// Our new best block height should be our start height + the number of
|
||||||
|
// blocks we just mined.
|
||||||
|
chainTip := startHeight + numBlocksMined
|
||||||
|
|
||||||
|
// Next, fetch all the current transaction details. We should find all
|
||||||
|
// of our transactions between our start height before we generated
|
||||||
|
// blocks, and our end height, which is the chain tip. This query does
|
||||||
|
// not include unconfirmed transactions, since all of our transactions
|
||||||
|
// should be confirmed.
|
||||||
err = waitForWalletSync(miner, alice)
|
err = waitForWalletSync(miner, alice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Couldn't sync Alice's wallet: %v", err)
|
t.Fatalf("Couldn't sync Alice's wallet: %v", err)
|
||||||
}
|
}
|
||||||
txDetails, err := alice.ListTransactionDetails()
|
txDetails, err := alice.ListTransactionDetails(
|
||||||
|
startHeight, chainTip,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to fetch tx details: %v", err)
|
t.Fatalf("unable to fetch tx details: %v", err)
|
||||||
}
|
}
|
||||||
@@ -1219,10 +1235,13 @@ func testListTransactionDetails(miner *rpctest.Harness,
|
|||||||
t.Fatalf("Couldn't sync Alice's wallet: %v", err)
|
t.Fatalf("Couldn't sync Alice's wallet: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should be able to find the transaction above in the set of
|
// Query our wallet for transactions from the chain tip, including
|
||||||
// returned transactions, and it should have a confirmation of -1,
|
// unconfirmed transactions. The transaction above should be included
|
||||||
// indicating that it's not yet mined.
|
// with a confirmation height of 0, indicating that it has not been
|
||||||
txDetails, err = alice.ListTransactionDetails()
|
// mined yet.
|
||||||
|
txDetails, err = alice.ListTransactionDetails(
|
||||||
|
chainTip, btcwallet.UnconfirmedHeight,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to fetch tx details: %v", err)
|
t.Fatalf("unable to fetch tx details: %v", err)
|
||||||
}
|
}
|
||||||
@@ -1259,18 +1278,27 @@ func testListTransactionDetails(miner *rpctest.Harness,
|
|||||||
t.Fatalf("unable to find mempool tx in tx details!")
|
t.Fatalf("unable to find mempool tx in tx details!")
|
||||||
}
|
}
|
||||||
|
|
||||||
burnBlock, err := miner.Node.Generate(1)
|
// Generate one block for our transaction to confirm in.
|
||||||
|
var numBlocks int32 = 1
|
||||||
|
burnBlock, err := miner.Node.Generate(uint32(numBlocks))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to mine block: %v", err)
|
t.Fatalf("unable to mine block: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Progress our chain tip by the number of blocks we have just mined.
|
||||||
|
chainTip += numBlocks
|
||||||
|
|
||||||
// Fetch the transaction details again, the new transaction should be
|
// Fetch the transaction details again, the new transaction should be
|
||||||
// shown as debiting from the wallet's balance.
|
// shown as debiting from the wallet's balance. Start and end height
|
||||||
|
// are inclusive, so we use chainTip for both parameters to get only
|
||||||
|
// transactions from the last block.
|
||||||
err = waitForWalletSync(miner, alice)
|
err = waitForWalletSync(miner, alice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Couldn't sync Alice's wallet: %v", err)
|
t.Fatalf("Couldn't sync Alice's wallet: %v", err)
|
||||||
}
|
}
|
||||||
txDetails, err = alice.ListTransactionDetails()
|
txDetails, err = alice.ListTransactionDetails(
|
||||||
|
chainTip, chainTip,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to fetch tx details: %v", err)
|
t.Fatalf("unable to fetch tx details: %v", err)
|
||||||
}
|
}
|
||||||
@@ -1302,6 +1330,30 @@ func testListTransactionDetails(miner *rpctest.Harness,
|
|||||||
if !burnTxFound {
|
if !burnTxFound {
|
||||||
t.Fatal("tx burning btc not found")
|
t.Fatal("tx burning btc not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generate a block which has no wallet transactions in it.
|
||||||
|
chainTip += numBlocks
|
||||||
|
_, err = miner.Node.Generate(uint32(numBlocks))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("unable to mine block: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = waitForWalletSync(miner, alice)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Couldn't sync Alice's wallet: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query for transactions only in the latest block. We do not expect
|
||||||
|
// any transactions to be returned.
|
||||||
|
txDetails, err = alice.ListTransactionDetails(
|
||||||
|
chainTip, chainTip,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
if len(txDetails) != 0 {
|
||||||
|
t.Fatalf("expected 0 transactions, got: %v", len(txDetails))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testTransactionSubscriptions(miner *rpctest.Harness,
|
func testTransactionSubscriptions(miner *rpctest.Harness,
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ func (m *mockWalletController) ListUnspentWitness(minconfirms,
|
|||||||
ret = append(ret, utxo)
|
ret = append(ret, utxo)
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
func (*mockWalletController) ListTransactionDetails() ([]*lnwallet.TransactionDetail, error) {
|
func (*mockWalletController) ListTransactionDetails(_, _ int32) ([]*lnwallet.TransactionDetail, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
func (*mockWalletController) LockOutpoint(o wire.OutPoint) {}
|
func (*mockWalletController) LockOutpoint(o wire.OutPoint) {}
|
||||||
|
|||||||
+16
-33
@@ -50,6 +50,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
||||||
"github.com/lightningnetwork/lnd/lntypes"
|
"github.com/lightningnetwork/lnd/lntypes"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet/chanfunding"
|
"github.com/lightningnetwork/lnd/lnwallet/chanfunding"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
@@ -4548,44 +4549,26 @@ func (r *rpcServer) SubscribeTransactions(req *lnrpc.GetTransactionsRequest,
|
|||||||
// GetTransactions returns a list of describing all the known transactions
|
// GetTransactions returns a list of describing all the known transactions
|
||||||
// relevant to the wallet.
|
// relevant to the wallet.
|
||||||
func (r *rpcServer) GetTransactions(ctx context.Context,
|
func (r *rpcServer) GetTransactions(ctx context.Context,
|
||||||
_ *lnrpc.GetTransactionsRequest) (*lnrpc.TransactionDetails, error) {
|
req *lnrpc.GetTransactionsRequest) (*lnrpc.TransactionDetails, error) {
|
||||||
|
|
||||||
// TODO(roasbeef): add pagination support
|
// To remain backwards compatible with the old api, default to the
|
||||||
transactions, err := r.server.cc.wallet.ListTransactionDetails()
|
// special case end height which will return transactions from the start
|
||||||
|
// height until the chain tip, including unconfirmed transactions.
|
||||||
|
var endHeight int32 = btcwallet.UnconfirmedHeight
|
||||||
|
|
||||||
|
// If the user has provided an end height, we overwrite our default.
|
||||||
|
if req.EndHeight != 0 {
|
||||||
|
endHeight = req.EndHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
transactions, err := r.server.cc.wallet.ListTransactionDetails(
|
||||||
|
req.StartHeight, endHeight,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
txDetails := &lnrpc.TransactionDetails{
|
return lnrpc.RPCTransactionDetails(transactions), nil
|
||||||
Transactions: make([]*lnrpc.Transaction, len(transactions)),
|
|
||||||
}
|
|
||||||
for i, tx := range transactions {
|
|
||||||
var destAddresses []string
|
|
||||||
for _, destAddress := range tx.DestAddresses {
|
|
||||||
destAddresses = append(destAddresses, destAddress.EncodeAddress())
|
|
||||||
}
|
|
||||||
|
|
||||||
// We also get unconfirmed transactions, so BlockHash can be
|
|
||||||
// nil.
|
|
||||||
blockHash := ""
|
|
||||||
if tx.BlockHash != nil {
|
|
||||||
blockHash = tx.BlockHash.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
txDetails.Transactions[i] = &lnrpc.Transaction{
|
|
||||||
TxHash: tx.Hash.String(),
|
|
||||||
Amount: int64(tx.Value),
|
|
||||||
NumConfirmations: tx.NumConfirmations,
|
|
||||||
BlockHash: blockHash,
|
|
||||||
BlockHeight: tx.BlockHeight,
|
|
||||||
TimeStamp: tx.Timestamp,
|
|
||||||
TotalFees: tx.TotalFees,
|
|
||||||
DestAddresses: destAddresses,
|
|
||||||
RawTxHex: hex.EncodeToString(tx.RawTx),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return txDetails, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DescribeGraph returns a description of the latest graph state from the PoV
|
// DescribeGraph returns a description of the latest graph state from the PoV
|
||||||
|
|||||||
+34
-2
@@ -39,6 +39,8 @@ var (
|
|||||||
utxnFinalizedKndrTxnKey = []byte("finalized-kndr-txn")
|
utxnFinalizedKndrTxnKey = []byte("finalized-kndr-txn")
|
||||||
|
|
||||||
byteOrder = binary.BigEndian
|
byteOrder = binary.BigEndian
|
||||||
|
|
||||||
|
errNoTxHashesBucket = errors.New("tx hashes bucket does not exist")
|
||||||
)
|
)
|
||||||
|
|
||||||
// SweeperStore stores published txes.
|
// SweeperStore stores published txes.
|
||||||
@@ -53,6 +55,9 @@ type SweeperStore interface {
|
|||||||
// GetLastPublishedTx returns the last tx that we called NotifyPublishTx
|
// GetLastPublishedTx returns the last tx that we called NotifyPublishTx
|
||||||
// for.
|
// for.
|
||||||
GetLastPublishedTx() (*wire.MsgTx, error)
|
GetLastPublishedTx() (*wire.MsgTx, error)
|
||||||
|
|
||||||
|
// ListSweeps lists all the sweeps we have successfully published.
|
||||||
|
ListSweeps() ([]chainhash.Hash, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type sweeperStore struct {
|
type sweeperStore struct {
|
||||||
@@ -173,7 +178,7 @@ func (s *sweeperStore) NotifyPublishTx(sweepTx *wire.MsgTx) error {
|
|||||||
|
|
||||||
txHashesBucket := tx.ReadWriteBucket(txHashesBucketKey)
|
txHashesBucket := tx.ReadWriteBucket(txHashesBucketKey)
|
||||||
if txHashesBucket == nil {
|
if txHashesBucket == nil {
|
||||||
return errors.New("tx hashes bucket does not exist")
|
return errNoTxHashesBucket
|
||||||
}
|
}
|
||||||
|
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
@@ -230,7 +235,7 @@ func (s *sweeperStore) IsOurTx(hash chainhash.Hash) (bool, error) {
|
|||||||
err := kvdb.View(s.db, func(tx kvdb.ReadTx) error {
|
err := kvdb.View(s.db, func(tx kvdb.ReadTx) error {
|
||||||
txHashesBucket := tx.ReadBucket(txHashesBucketKey)
|
txHashesBucket := tx.ReadBucket(txHashesBucketKey)
|
||||||
if txHashesBucket == nil {
|
if txHashesBucket == nil {
|
||||||
return errors.New("tx hashes bucket does not exist")
|
return errNoTxHashesBucket
|
||||||
}
|
}
|
||||||
|
|
||||||
ours = txHashesBucket.Get(hash[:]) != nil
|
ours = txHashesBucket.Get(hash[:]) != nil
|
||||||
@@ -244,5 +249,32 @@ func (s *sweeperStore) IsOurTx(hash chainhash.Hash) (bool, error) {
|
|||||||
return ours, nil
|
return ours, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListSweeps lists all the sweep transactions we have in the sweeper store.
|
||||||
|
func (s *sweeperStore) ListSweeps() ([]chainhash.Hash, error) {
|
||||||
|
var sweepTxns []chainhash.Hash
|
||||||
|
|
||||||
|
if err := kvdb.View(s.db, func(tx kvdb.ReadTx) error {
|
||||||
|
txHashesBucket := tx.ReadBucket(txHashesBucketKey)
|
||||||
|
if txHashesBucket == nil {
|
||||||
|
return errNoTxHashesBucket
|
||||||
|
}
|
||||||
|
|
||||||
|
return txHashesBucket.ForEach(func(resKey, _ []byte) error {
|
||||||
|
txid, err := chainhash.NewHash(resKey)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
sweepTxns = append(sweepTxns, *txid)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return sweepTxns, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Compile-time constraint to ensure sweeperStore implements SweeperStore.
|
// Compile-time constraint to ensure sweeperStore implements SweeperStore.
|
||||||
var _ SweeperStore = (*sweeperStore)(nil)
|
var _ SweeperStore = (*sweeperStore)(nil)
|
||||||
@@ -41,5 +41,15 @@ func (s *MockSweeperStore) GetLastPublishedTx() (*wire.MsgTx, error) {
|
|||||||
return s.lastTx, nil
|
return s.lastTx, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListSweeps lists all the sweeps we have successfully published.
|
||||||
|
func (s *MockSweeperStore) ListSweeps() ([]chainhash.Hash, error) {
|
||||||
|
var txns []chainhash.Hash
|
||||||
|
for tx := range s.ourTxes {
|
||||||
|
txns = append(txns, tx)
|
||||||
|
}
|
||||||
|
|
||||||
|
return txns, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Compile-time constraint to ensure MockSweeperStore implements SweeperStore.
|
// Compile-time constraint to ensure MockSweeperStore implements SweeperStore.
|
||||||
var _ SweeperStore = (*MockSweeperStore)(nil)
|
var _ SweeperStore = (*MockSweeperStore)(nil)
|
||||||
@@ -150,4 +150,28 @@ func testStore(t *testing.T, createStore func() (SweeperStore, error)) {
|
|||||||
if ours {
|
if ours {
|
||||||
t.Fatal("expected tx to be not ours")
|
t.Fatal("expected tx to be not ours")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txns, err := store.ListSweeps()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a map containing the sweeps we expect to be returned by list
|
||||||
|
// sweeps.
|
||||||
|
expected := map[chainhash.Hash]bool{
|
||||||
|
tx1.TxHash(): true,
|
||||||
|
tx2.TxHash(): true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(txns) != len(expected) {
|
||||||
|
t.Fatalf("expected: %v sweeps, got: %v", len(expected),
|
||||||
|
len(txns))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tx := range txns {
|
||||||
|
_, ok := expected[tx]
|
||||||
|
if !ok {
|
||||||
|
t.Fatalf("unexpected tx: %v", tx)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
@@ -1262,6 +1263,11 @@ func DefaultNextAttemptDeltaFunc(attempts int) int32 {
|
|||||||
return 1 + rand.Int31n(1<<uint(attempts-1))
|
return 1 + rand.Int31n(1<<uint(attempts-1))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListSweeps returns a list of the the sweeps recorded by the sweep store.
|
||||||
|
func (s *UtxoSweeper) ListSweeps() ([]chainhash.Hash, error) {
|
||||||
|
return s.cfg.Store.ListSweeps()
|
||||||
|
}
|
||||||
|
|
||||||
// init initializes the random generator for random input rescheduling.
|
// init initializes the random generator for random input rescheduling.
|
||||||
func init() {
|
func init() {
|
||||||
rand.Seed(time.Now().Unix())
|
rand.Seed(time.Now().Unix())
|
||||||
|
|||||||
Reference in new issue
Block a user