From 9ed6968fe524c954d0a7d9486d22d72828528a2d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 7 Jun 2015 15:33:24 +0930 Subject: [PATCH] add_varint: encode correctly (LE) Signed-off-by: Rusty Russell --- bitcoin_tx.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bitcoin_tx.c b/bitcoin_tx.c index cca1b6a6b..01dac5357 100644 --- a/bitcoin_tx.c +++ b/bitcoin_tx.c @@ -15,24 +15,24 @@ static void add_varint(varint_t v, *(p++) = v; } else if (v <= 0xffff) { (*p++) = 0xfd; - (*p++) = v >> 8; (*p++) = v; + (*p++) = v >> 8; } else if (v <= 0xffffffff) { (*p++) = 0xfe; - (*p++) = v >> 24; - (*p++) = v >> 16; - (*p++) = v >> 8; (*p++) = v; + (*p++) = v >> 8; + (*p++) = v >> 16; + (*p++) = v >> 24; } else { (*p++) = 0xff; - (*p++) = v >> 56; - (*p++) = v >> 48; - (*p++) = v >> 40; - (*p++) = v >> 32; - (*p++) = v >> 24; - (*p++) = v >> 16; - (*p++) = v >> 8; (*p++) = v; + (*p++) = v >> 8; + (*p++) = v >> 16; + (*p++) = v >> 24; + (*p++) = v >> 32; + (*p++) = v >> 40; + (*p++) = v >> 48; + (*p++) = v >> 56; } add(buf, p - buf, addp); }