| 1209 | } |
| 1210 | |
| 1211 | u32 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. */ |
no test coverage detected