| 1260 | } |
| 1261 | |
| 1262 | u32 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. */ |
no test coverage detected