Skip to main content

PendingSweeps

PendingSweeps returns lists of on-chain outputs that lnd is currently attempting to sweep within its central batching engine. Outputs with similar fee rates are batched together in order to sweep them within a single transaction.

NOTE: Some of the fields within PendingSweepsRequest are not guaranteed to remain supported. This is an advanced API that depends on the internals of the UtxoSweeper, so things may change.

Source: walletrpc/walletkit.proto

gRPC

rpc PendingSweeps (PendingSweepsRequest) returns (PendingSweepsResponse);

REST

HTTP MethodPath
GET /v2/wallet/sweeps/pending

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:10009'
const MACAROON_PATH = 'LND_DIR/data/chain/bitcoin/regtest/admin.macaroon'
const TLS_PATH = 'LND_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync(['lightning.proto', 'walletrpc/walletkit.proto'], loaderOptions);
const walletrpc = grpc.loadPackageDefinition(packageDefinition).walletrpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
const macaroon = fs.readFileSync(MACAROON_PATH).toString('hex');
const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
let metadata = new grpc.Metadata();
metadata.add('macaroon', macaroon);
callback(null, metadata);
});
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
let client = new walletrpc.WalletKit(GRPC_HOST, creds);
let request = {};
client.pendingSweeps(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "pending_sweeps": <PendingSweep>,
// }

Messages

walletrpc.PendingSweepsRequest

Source: walletrpc/walletkit.proto

note

This request has no parameters.

walletrpc.PendingSweepsResponse

Source: walletrpc/walletkit.proto

FieldgRPC TypeREST Type
pending_sweeps
PendingSweep[]array

Nested Messages

lnrpc.OutPoint

FieldgRPC TypeREST Type
txid_bytes
bytesstring
txid_str
stringstring
output_index
uint32integer

walletrpc.PendingSweep

FieldgRPC TypeREST Type
outpoint
OutPointobject
witness_type
WitnessTypestring
amount_sat
uint32integer
sat_per_bytedeprecated
uint32integer
broadcast_attempts
uint32integer
next_broadcast_heightdeprecated
uint32integer
forcedeprecated
boolboolean
requested_conf_targetdeprecated
uint32integer
requested_sat_per_bytedeprecated
uint32integer
sat_per_vbyte
uint64string
requested_sat_per_vbyte
uint64string
immediate
boolboolean
budget
uint64string
deadline_height
uint32integer

Enums

walletrpc.WitnessType

NameNumber
UNKNOWN_WITNESS
0
COMMITMENT_TIME_LOCK
1
COMMITMENT_NO_DELAY
2
COMMITMENT_REVOKE
3
HTLC_OFFERED_REVOKE
4
HTLC_ACCEPTED_REVOKE
5
HTLC_OFFERED_TIMEOUT_SECOND_LEVEL
6
HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL
7
HTLC_OFFERED_REMOTE_TIMEOUT
8
HTLC_ACCEPTED_REMOTE_SUCCESS
9
HTLC_SECOND_LEVEL_REVOKE
10
WITNESS_KEY_HASH
11
NESTED_WITNESS_KEY_HASH
12
COMMITMENT_ANCHOR
13
COMMITMENT_NO_DELAY_TWEAKLESS
14
COMMITMENT_TO_REMOTE_CONFIRMED
15
HTLC_OFFERED_TIMEOUT_SECOND_LEVEL_INPUT_CONFIRMED
16
HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL_INPUT_CONFIRMED
17
LEASE_COMMITMENT_TIME_LOCK
18
LEASE_COMMITMENT_TO_REMOTE_CONFIRMED
19
LEASE_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL
20
LEASE_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL
21
TAPROOT_PUB_KEY_SPEND
22
TAPROOT_LOCAL_COMMIT_SPEND
23
TAPROOT_REMOTE_COMMIT_SPEND
24
TAPROOT_ANCHOR_SWEEP_SPEND
25
TAPROOT_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL
26
TAPROOT_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL
27
TAPROOT_HTLC_SECOND_LEVEL_REVOKE
28
TAPROOT_HTLC_ACCEPTED_REVOKE
29
TAPROOT_HTLC_OFFERED_REVOKE
30
TAPROOT_HTLC_OFFERED_REMOTE_TIMEOUT
31
TAPROOT_HTLC_LOCAL_OFFERED_TIMEOUT
32
TAPROOT_HTLC_ACCEPTED_REMOTE_SUCCESS
33
TAPROOT_HTLC_ACCEPTED_LOCAL_SUCCESS
34
TAPROOT_COMMITMENT_REVOKE
35