ln-service
Version:
Interaction helper for your Lightning Network daemon
44 lines (28 loc) • 1.1 kB
JavaScript
const {equal} = require('node:assert').strict;
const test = require('node:test');
const asyncRetry = require('async/retry');
const {spawnLightningCluster} = require('ln-docker-daemons');
const {getChainTransactions} = require('./../../');
const {updateChainTransaction} = require('./../../');
const count = 100;
const description = 'description';
// Test updating the description of a chain transaction
test(`Send chain transaction`, async () => {
const [{generate, kill, lnd}] = (await spawnLightningCluster({})).nodes;
// Generate some funds
await generate({count});
const {transactions} = await getChainTransactions({lnd});
const [{id}] = transactions;
await asyncRetry({}, async () => {
await updateChainTransaction({description, id, lnd});
const {transactions} = await getChainTransactions({lnd});
const [tx] = transactions;
if (tx.description !== description) {
throw new Error('ExpectedTransactionDescriptionUpdated');
}
equal(tx.description, description, 'Got expected transaction');
return;
});
await kill({});
return;
});