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

Function default_locktime

lightningd/chaintopology.c:1211–1231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1209}
1210
1211u32 default_locktime(const struct chain_topology *topo)
1212{
1213 u32 locktime, current_height = get_block_height(topo);
1214
1215 /* Setting the locktime to the next block to be mined has multiple
1216 * benefits:
1217 * - anti fee-snipping (even if not yet likely)
1218 * - less distinguishable transactions (with this we create
1219 * general-purpose transactions which looks like bitcoind:
1220 * native segwit, nlocktime set to tip, and sequence set to
1221 * 0xFFFFFFFD by default. Other wallets are likely to implement
1222 * this too).
1223 */
1224 locktime = current_height;
1225
1226 /* Eventually fuzz it too. */
1227 if (locktime > 100 && pseudorand(10) == 0)
1228 locktime -= pseudorand(100);
1229
1230 return locktime;
1231}
1232
1233/* On shutdown, channels get deleted last. That frees from our list, so
1234 * do it now instead. */

Callers 4

finish_psbtFunction · 0.85
json_addpsbtoutputFunction · 0.85
json_addpsbtinputFunction · 0.85
anchor_psbtFunction · 0.85

Calls 1

get_block_heightFunction · 0.70

Tested by

no test coverage detected