MCPcopy Create free account
hub / github.com/ElementsProject/lightning / default_locktime

Function default_locktime

lightningd/chaintopology.c:1262–1282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1260}
1261
1262u32 default_locktime(const struct chain_topology *topo)
1263{
1264 u32 locktime, current_height = get_block_height(topo);
1265
1266 /* Setting the locktime to the next block to be mined has multiple
1267 * benefits:
1268 * - anti fee-snipping (even if not yet likely)
1269 * - less distinguishable transactions (with this we create
1270 * general-purpose transactions which looks like bitcoind:
1271 * native segwit, nlocktime set to tip, and sequence set to
1272 * 0xFFFFFFFD by default. Other wallets are likely to implement
1273 * this too).
1274 */
1275 locktime = current_height;
1276
1277 /* Eventually fuzz it too. */
1278 if (locktime > 100 && pseudorand(10) == 0)
1279 locktime -= pseudorand(100);
1280
1281 return locktime;
1282}
1283
1284/* On shutdown, channels get deleted last. That frees from our list, so
1285 * do it now instead. */

Callers 4

anchor_psbtFunction · 0.70
finish_psbtFunction · 0.50
json_addpsbtoutputFunction · 0.50
json_addpsbtinputFunction · 0.50

Calls 1

get_block_heightFunction · 0.70

Tested by

no test coverage detected