Open decryp2kanon opened 3 years ago
workaround:
nSatoshisPerK = nFeePaid * 1000 / nSize;
to
nSatoshisPerK = nFeePaid / nSize*1000;
<fuzz/util.h>
// Avoid:
// policy/feerate.cpp:28:34: runtime error: signed integer overflow: 34873208148477500 * 1000 cannot be represented in type 'long'
//
// Reproduce using CFeeRate(348732081484775, 10).GetFeePerK()
BTC has error too
// policy/feerate.cpp:28:34: runtime error: signed integer overflow: 34873208148477500 * 1000 cannot be represented in type 'long'
// nSatoshisPerK = nFeePaid * 1000 / nSize;
nSatoshisPerK = nFeePaid / nSize * 1000;
test/amount_tests.cpp(22): Entering test case "GetFeeTest"
test/amount_tests.cpp(78): error: in "amount_tests/GetFeeTest": check CFeeRate(CAmount(-1), 1000) == CFeeRate(-1) has failed
test/amount_tests.cpp(80): error: in "amount_tests/GetFeeTest": check CFeeRate(CAmount(1), 1000) == CFeeRate(1) has failed
test/amount_tests.cpp(83): error: in "amount_tests/GetFeeTest": check CFeeRate(CAmount(2), 1001) == CFeeRate(1) has failed
test/amount_tests.cpp(85): error: in "amount_tests/GetFeeTest": check CFeeRate(CAmount(26), 789) == CFeeRate(32) has failed
test/amount_tests.cpp(86): error: in "amount_tests/GetFeeTest": check CFeeRate(CAmount(27), 789) == CFeeRate(34) has failed
test/amount_tests.cpp(22): Leaving test case "GetFeeTest"; testing time: 31080us
https://github.com/sugarchain-project/yumekawa/blob/a14eadf6a06463fbb7ede23068c208cf5e217cff/src/test/fuzz/util.h#L127-L130
https://cirrus-ci.com/task/4665805700857856?command=ci#L4087