mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
add_varint: encode correctly (LE)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0203d51ec0
commit
9ed6968fe5
22
bitcoin_tx.c
22
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user