Browse Source
Add more assertions, throw if find_output params are invalid
pull/4/head
Jack Grigg
8 years ago
No known key found for this signature in database
GPG Key ID: 6A6914DAFBEA00DA
2 changed files with
4 additions and
1 deletions
-
src/random.h
-
src/wallet/asyncrpcoperation_sendmany.cpp
|
|
@ -43,6 +43,8 @@ void MappedShuffle(RandomAccessIterator first, |
|
|
|
{ |
|
|
|
for (size_t i = len-1; i > 0; --i) { |
|
|
|
auto r = gen(i+1); |
|
|
|
assert(r >= 0); |
|
|
|
assert(r <= i); |
|
|
|
std::swap(first[i], first[r]); |
|
|
|
std::swap(mapFirst[i], mapFirst[r]); |
|
|
|
} |
|
|
|
|
|
@ -36,13 +36,14 @@ int find_output(Object obj, int n) { |
|
|
|
} |
|
|
|
|
|
|
|
Array outputMap = outputMapValue.get_array(); |
|
|
|
assert(outputMap.size() == ZC_NUM_JS_OUTPUTS); |
|
|
|
for (size_t i = 0; i < outputMap.size(); i++) { |
|
|
|
if (outputMap[i] == n) { |
|
|
|
return i; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return -1; |
|
|
|
throw std::logic_error("n is not present in outputmap"); |
|
|
|
} |
|
|
|
|
|
|
|
AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany( |
|
|
|