mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
pyln-proto: Add compactsize alias for varint_{encode,decode}
We were mistakenly calling it varint, while Bitcoin refers to it as CompactSize.
This commit is contained in:
parent
895722fd8a
commit
9a0327cd25
1 changed files with 10 additions and 2 deletions
|
@ -2,7 +2,7 @@ import coincurve
|
|||
import struct
|
||||
|
||||
|
||||
def varint_encode(i, w):
|
||||
def compactsize_encode(i, w):
|
||||
"""Encode an integer `i` into the writer `w`
|
||||
"""
|
||||
if i < 0xFD:
|
||||
|
@ -15,7 +15,7 @@ def varint_encode(i, w):
|
|||
w.write(struct.pack("!BQ", 0xFF, i))
|
||||
|
||||
|
||||
def varint_decode(r):
|
||||
def compactsize_decode(r):
|
||||
"""Decode an integer from reader `r`
|
||||
"""
|
||||
raw = r.read(1)
|
||||
|
@ -33,6 +33,14 @@ def varint_decode(r):
|
|||
return struct.unpack("!Q", r.read(8))[0]
|
||||
|
||||
|
||||
def varint_encode(i, w):
|
||||
return compactsize_encode(i, w)
|
||||
|
||||
|
||||
def varint_decode(r):
|
||||
return compactsize_decode(r)
|
||||
|
||||
|
||||
class ShortChannelId(object):
|
||||
def __init__(self, block, txnum, outnum):
|
||||
self.block = block
|
||||
|
|
Loading…
Add table
Reference in a new issue