Fix block segfault
This commit is contained in:
parent
8ae0d4a2cb
commit
e7dcd41555
@ -67,7 +67,9 @@ if test -e "${root_dir}/libbitcoind/src/.libs/libbitcoind.${ext}"; then
|
||||
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.0.dylib" "${os_dir}/"
|
||||
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.dylib" "${os_dir}/"
|
||||
else
|
||||
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.so*" "${os_dir}/"
|
||||
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.so" "${os_dir}/"
|
||||
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.so.0" "${os_dir}/"
|
||||
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.so.0.0.0" "${os_dir}/"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@ -746,15 +746,20 @@ async_get_block(uv_work_t *req) {
|
||||
|
||||
std::string strHash = data->hash;
|
||||
uint256 hash(strHash);
|
||||
CBlock cblock;
|
||||
|
||||
CBlockIndex* pblockindex = mapBlockIndex[hash];
|
||||
|
||||
if (ReadBlockFromDisk(cblock, pblockindex)) {
|
||||
data->cblock = cblock;
|
||||
data->cblock_index = pblockindex;
|
||||
if (mapBlockIndex.count(hash) == 0) {
|
||||
data->err_msg = std::string("Block not found.");
|
||||
} else {
|
||||
data->err_msg = std::string("Block not found.");
|
||||
|
||||
CBlock block;
|
||||
CBlockIndex* pblockindex = mapBlockIndex[hash];
|
||||
|
||||
if(!ReadBlockFromDisk(block, pblockindex)) {
|
||||
data->err_msg = std::string("Can't read block from disk");
|
||||
} else {
|
||||
data->cblock = block;
|
||||
data->cblock_index = pblockindex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user