mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-20 20:49:50 +01:00
Merge #21043: net: Avoid UBSan warning in ProcessMessage(...)
3ddbf22ed1util: Disallow negative mocktime (MarcoFalke)f5f2f97168net: Avoid UBSan warning in ProcessMessage(...) (practicalswift) Pull request description: Avoid UBSan warning in `ProcessMessage(...)`. Context: https://github.com/bitcoin/bitcoin/pull/20380#issuecomment-770427182 (thanks Crypt-iQ!) ACKs for top commit: MarcoFalke: re-ACK3ddbf22ed1only change is adding patch written by me ajtowns: ACK3ddbf22ed1-- code review only Tree-SHA512: e8d7af0457ca86872b75a4e406c0a93aafd841c2962e244e147e748cc7ca118c56be0fdafe53765f4b291410030b2c3cc8f76f733b37a955d34fc885ab6037b9
This commit is contained in:
@@ -10,6 +10,7 @@ Test corresponds to code in rpc/server.cpp.
|
||||
import time
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_raises_rpc_error
|
||||
|
||||
|
||||
class UptimeTest(BitcoinTestFramework):
|
||||
@@ -18,8 +19,12 @@ class UptimeTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def run_test(self):
|
||||
self._test_negative_time()
|
||||
self._test_uptime()
|
||||
|
||||
def _test_negative_time(self):
|
||||
assert_raises_rpc_error(-8, "Mocktime can not be negative: -1.", self.nodes[0].setmocktime, -1)
|
||||
|
||||
def _test_uptime(self):
|
||||
wait_time = 10
|
||||
self.nodes[0].setmocktime(int(time.time() + wait_time))
|
||||
|
||||
Reference in New Issue
Block a user