From b128ea27a4ebdda81a979f566be916ec719eedce Mon Sep 17 00:00:00 2001 From: Mario Mejia Date: Mon, 19 Nov 2018 17:58:50 -0700 Subject: [PATCH 1/4] Added stakenet (XSN) support --- core/src/wallet/bitcoin/networks.cpp | 20 ++++++++++++++++++-- core/src/wallet/currencies.cpp | 10 +++++++++- core/src/wallet/currencies.hpp | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/core/src/wallet/bitcoin/networks.cpp b/core/src/wallet/bitcoin/networks.cpp index ebb2621f74..d082db36ca 100644 --- a/core/src/wallet/bitcoin/networks.cpp +++ b/core/src/wallet/bitcoin/networks.cpp @@ -395,6 +395,21 @@ namespace ledger { {} ); return DECRED; + } else if (networkName == "stakenet") { + static const api::BitcoinLikeNetworkParameters STAKENET( + "xsn", + {0x4C}, + {0x10}, + {0x04, 0x88, 0xB2, 0x1E}, + api::BitcoinLikeFeePolicy::PER_BYTE, + 10000, + "Stakenet Signed Message:\n", + false, + 0, + {sigHashType::SIGHASH_ALL}, + {} + ); + return STAKENET; } throw make_exception(api::ErrorCode::INVALID_ARGUMENT, "No network parameters set for {}", networkName); @@ -423,8 +438,9 @@ namespace ledger { getNetworkParameters("poswallet"), getNetworkParameters("pivx"), getNetworkParameters("clubcoin"), - getNetworkParameters("decred") + getNetworkParameters("decred"), + getNetworkParameters("stakenet") }); } } -} \ No newline at end of file +} diff --git a/core/src/wallet/currencies.cpp b/core/src/wallet/currencies.cpp index 5c6b211cc7..4b1b3d1b64 100644 --- a/core/src/wallet/currencies.cpp +++ b/core/src/wallet/currencies.cpp @@ -228,6 +228,13 @@ namespace ledger { .unit("satoshi", 0, "satoshi") .unit("decred", 8, "DCR") .unit("milli-decred", 5, "mDCR"); + const api::Currency STAKENET = + Currency("stakenet") + .forkOfBitcoin(networks::getNetworkParameters("stakenet")) + .bip44(384) + .paymentUri("stakenet") + .unit("satoshi", 0, "satoshi") + .unit("stakenet", 8, "XSN"); const std::vector ALL({ BITCOIN, @@ -251,7 +258,8 @@ namespace ledger { POSWALLET, PIVX, CLUBCOIN, - DECRED + DECRED, + STAKENET }); } } diff --git a/core/src/wallet/currencies.hpp b/core/src/wallet/currencies.hpp index 3af7a586aa..7b6f2818ad 100644 --- a/core/src/wallet/currencies.hpp +++ b/core/src/wallet/currencies.hpp @@ -67,6 +67,7 @@ namespace ledger { extern LIBCORE_EXPORT const api::Currency PIVX; extern LIBCORE_EXPORT const api::Currency CLUBCOIN; extern LIBCORE_EXPORT const api::Currency DECRED; + extern LIBCORE_EXPORT const api::Currency STAKENET; }; } } From 291a8b1fc4620e0a8549b4eca6d87ea1154cbbe8 Mon Sep 17 00:00:00 2001 From: KhalilBellakrid Date: Thu, 3 Jan 2019 23:22:18 +0100 Subject: [PATCH 2/4] Activate Sapling for Komodo --- core/src/wallet/bitcoin/networks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/wallet/bitcoin/networks.cpp b/core/src/wallet/bitcoin/networks.cpp index d082db36ca..34df861a6d 100644 --- a/core/src/wallet/bitcoin/networks.cpp +++ b/core/src/wallet/bitcoin/networks.cpp @@ -331,7 +331,7 @@ namespace ledger { false, 0, {sigHashType::SIGHASH_ALL}, - {} + {"ZIP"} ); return KOMODO; } else if (networkName == "poswallet") { From 59dab020792de7bd6659eaa49cea01a4d0aebe26 Mon Sep 17 00:00:00 2001 From: KhalilBellakrid Date: Thu, 3 Jan 2019 23:24:37 +0100 Subject: [PATCH 3/4] Preparing 1.1.8: support for XSN, support of Komodo Sapling --- CMakeLists.txt | 2 +- appveyor.yml | 2 +- core/src/wallet/bitcoin/networks.cpp | 22 +++++++++++----------- djinni | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b114ccfe79..49328bcab4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ include(UseBackportedModules) # The project version number. set(VERSION_MAJOR 1 CACHE STRING "Project major version number.") set(VERSION_MINOR 1 CACHE STRING "Project minor version number.") -set(VERSION_PATCH 7 CACHE STRING "Project patch version number.") +set(VERSION_PATCH 8 CACHE STRING "Project patch version number.") mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build) diff --git a/appveyor.yml b/appveyor.yml index 0235739473..b3e4bd7ac7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,7 @@ version: 1.0.{build} image: - Visual Studio 2015 environment: - LIB_VERSION: 1.1.7 #Hardcode the LIB_VERSION : should be retrieved by building libcore node module and run tests/lib_version.js + LIB_VERSION: 1.1.8 #Hardcode the LIB_VERSION : should be retrieved by building libcore node module and run tests/lib_version.js nodejs_version: "9" appveyor_rdp_password: secure: jb1LsDmcxCww7tA38S3xSw== diff --git a/core/src/wallet/bitcoin/networks.cpp b/core/src/wallet/bitcoin/networks.cpp index 34df861a6d..b5d05de704 100644 --- a/core/src/wallet/bitcoin/networks.cpp +++ b/core/src/wallet/bitcoin/networks.cpp @@ -397,17 +397,17 @@ namespace ledger { return DECRED; } else if (networkName == "stakenet") { static const api::BitcoinLikeNetworkParameters STAKENET( - "xsn", - {0x4C}, - {0x10}, - {0x04, 0x88, 0xB2, 0x1E}, - api::BitcoinLikeFeePolicy::PER_BYTE, - 10000, - "Stakenet Signed Message:\n", - false, - 0, - {sigHashType::SIGHASH_ALL}, - {} + "xsn", + {0x4C}, + {0x10}, + {0x04, 0x88, 0xB2, 0x1E}, + api::BitcoinLikeFeePolicy::PER_BYTE, + 10000, + "Stakenet Signed Message:\n", + false, + 0, + {sigHashType::SIGHASH_ALL}, + {} ); return STAKENET; } diff --git a/djinni b/djinni index 16ec7cc3cb..1b985bce1e 160000 --- a/djinni +++ b/djinni @@ -1 +1 @@ -Subproject commit 16ec7cc3cbfc810a836a12e96c1a376f8aea7b46 +Subproject commit 1b985bce1e230a33bd7442416f24f202466476ce From 87ef4c6939b127277c056b6e7febc38e89da54aa Mon Sep 17 00:00:00 2001 From: KhalilBellakrid Date: Fri, 4 Jan 2019 15:09:02 +0100 Subject: [PATCH 4/4] Fix raw tx parsing: previous tx hash was parsed as BigInt ... --- .../wallet/bitcoin/api_impl/BitcoinLikeTransactionApi.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/wallet/bitcoin/api_impl/BitcoinLikeTransactionApi.cpp b/core/src/wallet/bitcoin/api_impl/BitcoinLikeTransactionApi.cpp index 970f76d2fa..4c1073df7b 100644 --- a/core/src/wallet/bitcoin/api_impl/BitcoinLikeTransactionApi.cpp +++ b/core/src/wallet/bitcoin/api_impl/BitcoinLikeTransactionApi.cpp @@ -467,7 +467,10 @@ namespace ledger { std::vector preparedInputs; auto inputsCount = reader.readNextVarInt(); for (auto index = 0; index < inputsCount; index++) { - auto previousTxHash = hex::toString(reader.readNextLeBigInt(32).toByteArray()); + //Previous Tx Hash in LE + auto prevTxHashBytes = reader.read(32); + std::reverse(prevTxHashBytes.begin(), prevTxHashBytes.end()); + auto previousTxHash = hex::toString(prevTxHashBytes); auto outputIndex = reader.readNextLeUint(); ledger::core::BitcoinLikeBlockchainExplorer::Output output;