From a589daa2353ffdd01385245c5d0a04d70b89ec71 Mon Sep 17 00:00:00 2001 From: darosior Date: Thu, 30 Jan 2020 12:56:27 +0100 Subject: [PATCH] wallet: fuzz the nLockTime added to withdraw transactions --- wallet/walletrpc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index 06220e0f2..dbef2a874 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -288,9 +289,11 @@ static struct command_result *json_prepare_tx(struct command *cmd, * native segwit, nlocktime set to tip, and sequence set to * 0xFFFFFFFE by default. Other wallets are likely to implement * this too). - * FIXME: Do we want to also fuzz this like bitcoind does ? */ locktime = cmd->ld->topology->tip->height; + /* Eventually fuzz it too. */ + if (pseudorand(10) == 0) + locktime -= (u32)pseudorand(100); } if (!feerate_per_kw) {