forked from such-gitea/wownero-lws
Port monero-lws to wownero-lws
Adapts monero-lws for Wownero cryptocurrency: - Rename all monero-lws-* binaries to wownero-lws-* - Update submodule to point to official Wownero repo - Use Wownero default ports (RPC: 34568, ZMQ: 34569) - Update data directory to ~/.wownero/light_wallet_server - Adapt next_difficulty() calls for Wownero API signature Key technical changes for Wownero compatibility: - BulletproofPlus (RCTTypeBulletproofPlus, type 8) commitment verification: Wownero stores BP+ commitments in 'divided by 8' form. Must call rct::scalarmult8() on outPk commitment before comparing with computed commitment (mask*G + amount*H). This is essential for amount decryption. - Pass rct_type to decode_amount() for proper commitment handling - Handle Wownero's ZMQ JSON format for ecdhTuple (32-byte mask/amount fields) No fork of Wownero is required - uses official codeberg.org/wownero/wownero.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# Copyright (c) 2018-2020, The Monero Project
|
||||
# Copyright (c) 2024-2025, The Wownero Project
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -26,9 +27,9 @@
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set(monero-lws-db_sources account.cpp data.cpp storage.cpp string.cpp)
|
||||
set(monero-lws-db_headers account.h data.h fwd.h storage.h string.h)
|
||||
set(wownero-lws-db_sources account.cpp data.cpp storage.cpp string.cpp)
|
||||
set(wownero-lws-db_headers account.h data.h fwd.h storage.h string.h)
|
||||
|
||||
add_library(monero-lws-db ${monero-lws-db_sources} ${monero-lws-db_headers})
|
||||
target_include_directories(monero-lws-db PUBLIC "${LMDB_INCLUDE}")
|
||||
target_link_libraries(monero-lws-db monero::libraries monero-lws-common monero-lws-lmdb monero-lws-wire-msgpack ${LMDB_LIB_PATH})
|
||||
add_library(wownero-lws-db ${wownero-lws-db_sources} ${wownero-lws-db_headers})
|
||||
target_include_directories(wownero-lws-db PUBLIC "${LMDB_INCLUDE}")
|
||||
target_link_libraries(wownero-lws-db wownero-lws-common wownero-lws-lmdb wownero-lws-wire-msgpack ${LMDB_LIB_PATH} wownero::libraries)
|
||||
|
||||
@@ -3178,8 +3178,14 @@ namespace db
|
||||
std::min(lmdb::to_native(last_block.id), last_update);
|
||||
|
||||
const std::uint64_t offset = last_same - lmdb::to_native(height);
|
||||
if (MONERO_UNWRAP(do_get_block_hash(*blocks_cur, block_id(last_same))) != *(chain_copy.begin() + offset))
|
||||
const crypto::hash stored_hash = MONERO_UNWRAP(do_get_block_hash(*blocks_cur, block_id(last_same)));
|
||||
const crypto::hash scanner_hash = *(chain_copy.begin() + offset);
|
||||
if (stored_hash != scanner_hash)
|
||||
{
|
||||
MERROR("Hash mismatch at block " << last_same << ": DB has " << stored_hash << ", scanner has " << scanner_hash << ". FORCING ROLLBACK to " << last_same);
|
||||
MONERO_CHECK(rollback_chain(this->db->tables, txn, *blocks_cur, block_id(last_same)));
|
||||
return {lws::error::blockchain_reorg};
|
||||
}
|
||||
|
||||
chain_copy.remove_prefix(offset + 1);
|
||||
MONERO_CHECK(
|
||||
|
||||
Reference in New Issue
Block a user