🐛 Fix serial number arithmetics

This commit is contained in:
otthorn 2021-04-15 00:35:04 +02:00
parent 88d6f38e03
commit c935fa152a

5
lib.py
View file

@ -87,10 +87,11 @@ def update_serial(serial, serial_bits=32):
"""Update serial number """Update serial number
According to RFC 1982 and Knot implementation. According to RFC 1982 and Knot implementation.
SERIAL_BITS = 32 by default. SERIAL_BITS = 32 by default, which means the serial number counter can
range from 0 to 2^32 - 1.
""" """
serial = serial + 1 % 2**32 serial = (serial + 1) % 2**serial_bits
return serial return serial