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

walletrpc.PendingSweep

FieldgRPC TypeREST Type
outpoint
OutPointobject
witness_type
WitnessTypestring
amount_sat
uint32integer
sat_per_byte
uint32integer
broadcast_attempts
uint32integer
next_broadcast_height
uint32integer
requested_conf_target
uint32integer
requested_sat_per_byte
uint32integer
sat_per_vbyte
uint64string
requested_sat_per_vbyte
uint64string
force
boolboolean

lnrpc.OutPoint

FieldgRPC TypeREST Type
txid_bytes
bytesstring
txid_str
stringstring
output_index
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