Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the nonce starting point debug log (#408)
I saw this log ``` $ docker logs libxmtp-repnode-1 2025-01-13T19:00:47.094Z INFO replication Version: v0.1.3-38-g0a896ad 2025-01-13T19:00:47.190Z INFO replication Starting server with blockchain nonce: 18446744073709551615 2025-01-13T19:00:47.192Z INFO replication Registrant identified {"nodeId": 100} ``` and realized that we are printing the nonce is a bit of a confusing fashion. The issue with the code lies in attempting to decrement a uint64 value (nonce) and ensuring it doesn't underflow. Since uint64 is an unsigned integer, it cannot hold negative values. If nonce is already 0, decrementing it would result in an underflow, wrapping around to its maximum value (18446744073709551615). The resulting behavior is exactly the same, but the log no longer looks like an error.
- Loading branch information