From 977e93cbaac1eda244f937200bc8e4852ccfc25a Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 13 Sep 2021 13:12:37 -0400 Subject: [PATCH 01/16] Get rid of wolfssl warning about timing resistance --- src/wallet/crypter.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wallet/crypter.cpp b/src/wallet/crypter.cpp index 17519c0ca..ff0da14d6 100644 --- a/src/wallet/crypter.cpp +++ b/src/wallet/crypter.cpp @@ -2,7 +2,6 @@ // Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html - /****************************************************************************** * Copyright © 2014-2019 The SuperNET Developers. * * * @@ -17,17 +16,21 @@ * Removal or modification of this copyright notice is prohibited. * * * ******************************************************************************/ - #include "crypter.h" - #include "script/script.h" #include "script/standard.h" #include "streams.h" #include "util.h" - #include #include #include +// TODO: these are not set correctly by wolfssl for some reason. Ja bless. +#undef ECC_TIMING_RESISTANT +#undef TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT 420 +#define TFM_TIMING_RESISTANT 420 +#undef WC_RSA_BLINDING +#define WC_RSA_BLINDING #include #include From 49713d8a0441d233998ea763576dec42a1bd89c0 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 14 Sep 2021 16:00:08 -0400 Subject: [PATCH 02/16] Various things --- src/hush_bitcoind.h | 10 +++--- src/hush_defs.h | 75 ++++++++++++++++++++++++++++++++++++++++-- src/hush_globals.h | 2 +- src/hush_notary.h | 24 +++++++++++--- src/main.cpp | 3 +- src/rpc/crosschain.cpp | 45 +++++++------------------ src/rpc/server.cpp | 4 ++- 7 files changed, 114 insertions(+), 49 deletions(-) diff --git a/src/hush_bitcoind.h b/src/hush_bitcoind.h index bf53316db..e2b4e9fa7 100644 --- a/src/hush_bitcoind.h +++ b/src/hush_bitcoind.h @@ -868,18 +868,18 @@ int32_t hush_minerids(uint8_t *minerids,int32_t height,int32_t width) return(nonz); } -int32_t hush_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) +int32_t hush_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) { - int32_t depth,notarized_ht; uint256 MoM,kmdtxid; - depth = hush_MoMdata(¬arized_ht,&MoM,&kmdtxid,nHeight,MoMoMp,MoMoMoffsetp,MoMoMdepthp,kmdstartip,kmdendip); + int32_t depth,notarized_ht; uint256 MoM,hushtxid; + depth = hush_MoMdata(¬arized_ht,&MoM,&hushtxid,nHeight,MoMoMp,MoMoMoffsetp,MoMoMdepthp,kmdstartip,kmdendip); memset(MoMp,0,sizeof(*MoMp)); - memset(kmdtxidp,0,sizeof(*kmdtxidp)); + memset(hushtxidp,0,sizeof(*hushtxidp)); *notarized_heightp = 0; if ( depth != 0 && notarized_ht > 0 && nHeight > notarized_ht-depth && nHeight <= notarized_ht ) { *MoMp = MoM; *notarized_heightp = notarized_ht; - *kmdtxidp = kmdtxid; + *hushtxidp = hushtxid; } return(depth); } diff --git a/src/hush_defs.h b/src/hush_defs.h index 8fa2024ee..c88abe9d6 100644 --- a/src/hush_defs.h +++ b/src/hush_defs.h @@ -53,13 +53,15 @@ const uint32_t nHushHardforkHeight = 166250; const uint32_t nHushHardforkHeight2 = 245055; // This height begins Hush DPoW from Hush notaries -const uint32_t nHushHardforkHeight3 = 340420; - -// No coins/code are currently using timestamp activated fork +const uint32_t nHushHardforkHeight3 = 340420; const uint32_t nHushHardforkTimestamp = 1580303652; // Jan 29nd 1pm GMT const uint32_t nHushHardforkTimestamp2 = 1594425600; // Jul 11th 12a GMT +// Used by HSCs static const uint32_t HUSH_SEASON_TIMESTAMPS[NUM_HUSH_SEASONS] = {1525132800, 1563148800, nHushHardforkTimestamp, nHushHardforkTimestamp2, nHushHardforkTimestamp2*5, nHushHardforkTimestamp2*6, nHushHardforkTimestamp2*7}; + +// Used by HUSH3+TUSH +// Block 1702100 = nHushHardforkHeight3*5 static const int32_t HUSH_SEASON_HEIGHTS[NUM_HUSH_SEASONS] = {1,2,nHushHardforkHeight, nHushHardforkHeight2, (int)340000, nHushHardforkHeight3, nHushHardforkHeight3*5}; // Era array of pubkeys. Add extra seasons to bottom as requried, after adding appropriate info above. @@ -472,6 +474,73 @@ static const char *notaries_elected[NUM_HUSH_SEASONS][NUM_HUSH_NOTARIES][2] = {"RAJWHL6MzGFKg7KB2sZ87KPQUSvxy3VrEW", "0389971362b002ab5dfa1b5f9c4f88e68249511a3935242ba1e0d31c1c88a36d70"}, {"RU592tQnbH8gt6xd5Uu23nEw3SucDNkXmK", "02b8b6a2266fe57b25f2d4b1da93a07d27930154e78f9d137bc7509cf1ae8e3d49"}, {"RLGCLRzaEmruPC9UmVt5qRHEhXwHip1e6d", "02a2fd96b4459411ad2b09597ba59cf52b282c56330da7c0cc6d2a5c0323a18f1e"} + }, + { + // season 7 + {"RFetqf8WUfWnwNeXdknkm8ojk7EXnYFzrv", "038a1bd41a08f38edda51042988022933c5775dfce81f7bae0b32a9179650352ac"}, + {"RV7YSVW89WC9jBDtFG4ubtopDRove4Tfvc", "03c9d35488be73fe4f2dbb1dc011468482d71bac32249f8cce6480bcc574415d19"}, + {"RBPFE9oXceZBWTn3Vhne4FUKE9vxGEXUKX", "028a8bb6ded2692b39a69ec2d3c9836ff221815909d5cd65257374aeb66394a002"}, + {"RM3cvUcafPhjyypZLEginQjdhjLnSgJHte", "03a36180014115b47b97c1c8776a269bba66047b1ce2c7eb1a3d4e995a6dfff0df"}, + {"RFFX1VaTmZYPBLCzFj7w3iJQArV9ZdaWcW", "02190865f3ca3678d322c96e49a3ddf8ad394a4c8cd97d4bb3376cf547d0d83c66"}, + {"RDwZsLpH1QiAbJwUEY8ajXwTzu3PaWhx7n", "023ea0babb34e1ff9f4db8131ee84ad8991b954038a1e6ef9afc2a1b3fa13bbcb9"}, + {"RCUvfnmt16ZMvLTmLGGAztcAE8fBjfbP6u", "0379a5ba9fb6b463ffcdc0b1f3ecf45a5b737275354f9c2598492f20660f6f7dfd"}, + {"RBLu9adNVMVf6jzLLbAenWovcwq8nU6gYd", "022cd69381231d69d6d3b9638762df849bc7bbab71cbb8383eec29ca677f1afa30"}, + {"RWfv6wd2fwgecnJxC1Ykpf1SJefGh2Wc6i", "03da8a8f57d88afb61f712a8cd35462b65ce2b2575db8f9ee33a725dcd12c44755"}, + {"RWiK4xooG3dPdvaovu6JvR3DWoYD4tfRjx", "02ffe66af4d71345fe6984b5002ad69206e1817566a70d9ac406a679be6a3335a0"}, + {"RYLNiJiRnEGeMxx1Q2xLoFujshRNkBa2x4", "028ef6501004569c1170ce2d7ec7ecfe5739001130ad1b39129f8b88cd3d610257"}, + {"RTw36Ksy5Wk1Xv3B53T79zoRd6XDsE9MS6", "02d7cf4ece00895ca857fcdd0a4c2fc9c949a518d2750396f77d9f031c08a94364"}, + {"RTPkUBriQzZy67WmFhEs6aQzJn5HBB3ntb", "03319ca1eae5888c45115d160ac07c4f2abd1720926aa579d535c4b46c807bb7f7"}, + {"RBmZzttvDnMaEv47cWXs8SgdC993djB68r", "034302c4e1ff72a5f5391f259f7a46e646c7845aa2c9de9fb0c0a4c4802aad79d6"}, + {"RGocb2jLCa2E9kVHDUsijrVGTDP82ngGYZ", "024440a18a16e38b836b3ad9bb54ab0b5ba83b04edebb58c62c09b2de29e9fc703"}, + {"RVqwCjPQ6AJ6r9WeGzQvAT4eGXDScprLkW", "028a94e53ad8ed9e78f0f8a87cf3bc4754784222ad7ddf2d3dc5fafec2f6891cde"}, + {"RB2Xc8eLrATRWVsxrZKHHx3hyJz1vugMt9", "02eca07a9b5810fe929a87f90e5f02e29a06479d39cd3a888abfa1793e1565155a"}, + {"RKm7WUuFfqCTiUBkbxBsdh54nT6ivXpDPX", "03e3f634671005c8ffb7fe883fcf9e08f6f5486df057f215d761741d91c88de898"}, + {"RLbHTvFQoz946W3o3gXTrjxxADeUsWWW16", "02e6bb6dcecf5e3abfe239dec55842a92f096eeac7f0ff7621c3e8948e5e789b27"}, + {"RD75njr2RLGC5PqjHbWwuL7ndTqZiUfYxs", "0250d9996c25a34cb1b4e86303a297fc5c49c65615eb31a57fb17d1e1b376e71be"}, + {"RT1VTzZYZLWUsPWFJ2oypEqB1MXMfq8b5Y", "02d1797941b7df42a98f59ede0f22294e7c02754232a8b1de9512ededaf3f82880"}, + {"RKeXriTVXioHeKpFTjC8Cjohd6DHGUcKqt", "0341e62f0cdffc4ba3e0efb793c0fcaaad1b611db7021b844f643d5c25847733d2"}, + {"RQYrDEgZPKMFAgTHNkWFeMHEmpkXe8j28T", "02b8719cd8484755990158cbdf7b9d990d4a5c3741cabe204e51ed04be5bd50133"}, + {"RE85TACcn8CEn26itAxQV9afxV9mVg17vm", "0367f569d3dc304e699196fe9b798671fe3f12df7851a0a474879b0dbf8bc508d1"}, + {"RPYWQJXto1aeCGe8T6g9Wo4tAL4xE82LJ8", "02cf1e245dfb44e418fd550abb825a600e1753d46a51995970e70c98be539da33e"}, + {"RSVHRS5wqEw7bxfuE9k6xJGbARcy5guisp", "03ab8ac83d689ce76b5d29a54c3b34d0a6cb37d64313ff4467c744787475969a23"}, + {"REAQwBaJFo6DyBkwfW7rTTDbUtkdmATcQ8", "025e80f0075514cc5940de85c0c559efa99a3688faf6cccb8c1d1f38b96ca91e71"}, + {"RF1gz8QBw5uFScGasqVxoUjQwJCD9zHJwC", "031cdae4b545e5049ccee8e0cb792e25795b56e08b5e64b1d972c9b94e9bfd4ed0"}, + {"RTnLGoWzpsyoGSViGH8GyYcYhSveSEmnPV", "03cf3403a9d1cefa83e07b73e618a7f991d140a8283a02df3ce7c00223f27f43d0"}, + {"RArURqxp6qfF7fqv38tCYr6p4zBtLtqf4x", "026bc4c91c2c35fabe88fea6470d6cda98977a97c251656adf25b81653c00c3800"}, + {"RN8GCryShNFvBWtcNEWrQJ5A9AWb3JJoXt", "02afa94f6574cd0fe4f5dc83b09a2112457862421ce96bdc75c1cf25ef5b1f8c4b"}, + {"RQSC2eBckcFPWzq9UtofePC31wgDySfJtw", "035d570768d844c8150a3bd966a2e13aa99316f4ab3e80370c4d16fb02f95d0974"}, + {"RC4uQsfH6jXpgnTFuFiDwAFo58gHLNkWo7", "02402b0ab7001fd4bcb4fa0d8d7006a6c521b1c76e85aad7b374ecd6c5d564c237"}, + {"RREcuaUWSkNzTNPBbFLbXKTKiC4fd5t47J", "03d5bf8b43c44ba064e897da47dd36dba537bebf013d28247ce7a088496dd9b66d"}, + {"REFyC5e7kmse3PUapDuXHL2xmtYEGttYYL", "035f56fd01dd21725928bbd878b795dccafecc03b978dc83748e9194dcbfebfb79"}, + {"RH1BLwZosLp2hv9msdZGdSu93K8GrMWw7D", "0224ab22ece88f624f80a8535b8d5194646ad6be749070ec188a22c5e29fdd7098"}, + {"RNkhugMQVbqDysSayHu2eAhTQpXzKWqZ3m", "02caab4c83c8cc245a7aeb6d25504363555d1b0874aef0f9f8116b4ddb61f24799"}, + {"RKiyhLELDJATA7ZCUcutkP1WCEHnAgZRZ8", "028c01859a700ed3941a5786cf2043992e17a45c6689ac4bf608ad3f19e6d0e832"}, + {"RLKARvLNo6Abkh5qh5NVn2HJmYfj8ELa6A", "0300a33629da90b9d3c0519d796f4b1278355bb8c46e4caee04b1305e2ab2ff3f2"}, + {"RACX21FKLenyyEf8SYK3LmjsDzkDthwUbR", "0205d73c6a3e969eff29e5f424c861d22544245e09eaafc3fefe021cad052b7c0b"}, + {"RETb7pEDauKBEuTBuXDhKS3ksd2p8x9KYa", "025c1f7596fd0b7286e6ebd1b3c275a14a13aa4d134db4677769324969b7b7e3a5"}, + {"RJrAo78TL6zUmiHXbBv8oRhfGKxGnPnxUu", "02d40a76fbab96a78898b7579626be6dfe360c63b91030e513f849f212d57c1af6"}, + {"RL8g6ANxhZBPHHHWgApaiSQ2BSP9qKwuwf", "020236a5748ea49da891276bcb85dc03487cb9f3d0c2b2cdb35227b6a624f86797"}, + {"RY3vwBjuuTCiYL5am9HmwbdCjffWd9f4CE", "032f61fd08957d9b88dabc077d8732bef6c30d0234c14e02f3a741116834f591dc"}, + {"RQW4LsSzjCPtNw1HGamSaCoiirvsrZmDY5", "02e29451f9baf0186a655396726a22a20617a3e54ea895590f6066abc993f83d32"}, + {"RJtjorxqhazz39UpFdhDW8MiW4E3jhXDNk", "03795b7a650db872c22f13a9c88ad5c1ad3cb07a349f1f29e9789efd27e151164b"}, + {"RSi8AiCCtS3doFupdpdfuorAhkrCS6mLMu", "037a62ff6b7eb2ba1e170b5c42e7788817ded6a3a7ed841321c01cc107aa647d42"}, + {"RMjMXC8m9PgAaMMvwqgLCyCrv47pp6F6XY", "033bdf151c01bc733e614f9d4f204ca44396bf56984df6643205d349a35f7b265d"}, + {"RYB3ZMgHt4h7YL8TUzpqaSDw22ABksAPGC", "021266e045f95322fceddae02877dca9721792bef8f2be28cacd7c36290cd813a7"}, + {"RGwy64PXswUKpiepfzgaRW98v3gsuqPtow", "03008783c34c2622e7167f0a5201846133e530e89dfe1a8fbcf4c29b33051c4565"}, + {"RKJRPLaQV4AkWF6EfUUzFwawTGU4RQZgcS", "03c20a9fd21de76a20ffc87e384be735dfabb7f34a2d881ca9714830fb1bbe6bdb"}, + {"RQ4SPvBKTEKyV6y31iSihtfMxi3KeyAJgV", "033c5a23c75d946c15c15fac1e6d78e08c2b656549a158627cfb6bc44bb7b3a560"}, + {"RTvRBC1pCQpPKrS27Q4hUCVKVpa5tSTsFS", "02c25672fae388a0613d0127fcfe38ef37f5f354ecfdea0fb734528e354319bd9d"}, + {"RKxWu9HpCg7m3UeUGw2Xs1SpFiR96fSCQj", "02ec760d09b369b82b34d864af5a468d8a7dc5609b06bce455d045d1059c4b0f71"}, + {"RBAaUWAD8jwVLL7ueb7ciAQewqgheKxwdk", "0274ec3abcca214cdf7f1a565f5f3d3fa910e62e751a1ab0de148ea14ba72d6ba7"}, + {"RT853SBEGt4EWrKbpSujya69DG1jSNYjob", "02e80260ca44b8539159e6af678cf5ed0bc596753e4985f66418d6417085b4104e"}, + {"RKjEuhVByPwJcZ9wuBgfELiCVnBrc4F8i4", "0357c38f5d5eb1662a54b980c9243ddd8b2100d4b2b9f8175246938ef76e100678"}, + {"RT6wVuFFPU5tY6C7Buup1GLV3SE5mpYEha", "02571085ead1aca86b9e90fa9a23d99a194c862524b0c714102888be5bf122dc7d"}, + {"RSTgcpV82AivrvWJpd4LR2KwWirwbwXE3Y", "021a0ee4611ca4d8a2e209cc43b95036deb0a9d1cc31fc9f87d50233a44f05ec1a"}, + {"RCiaXRzo4AAG3zmPL3Hx63NsRWv5UGiNuM", "02f4876be65c54613e47f7fac67f1453e8d8fde5e19fa53f278a1083a08b258ab3"}, + {"RCGgLWrTTaqBhUsS1BqrmFpJZAdNJMzscv", "02893d2db5329b15a33aa7edfbf323c85cabbdc25caa6cf6186fac6052ae6d96a0"}, + {"RAJWHL6MzGFKg7KB2sZ87KPQUSvxy3VrEW", "0389971362b002ab5dfa1b5f9c4f88e68249511a3935242ba1e0d31c1c88a36d70"}, + {"RU592tQnbH8gt6xd5Uu23nEw3SucDNkXmK", "02b8b6a2266fe57b25f2d4b1da93a07d27930154e78f9d137bc7509cf1ae8e3d49"}, + {"RLGCLRzaEmruPC9UmVt5qRHEhXwHip1e6d", "02a2fd96b4459411ad2b09597ba59cf52b282c56330da7c0cc6d2a5c0323a18f1e"} } }; diff --git a/src/hush_globals.h b/src/hush_globals.h index 12f4f7f65..605d78021 100644 --- a/src/hush_globals.h +++ b/src/hush_globals.h @@ -21,7 +21,7 @@ void hush_prefetch(FILE *fp); uint32_t hush_heightstamp(int32_t height); void hush_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint32_t ktime,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth); void hush_init(int32_t height); -int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip); +int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip); int32_t hush_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp); char *hush_issuemethod(char *userpass,char *method,char *params,uint16_t port); void hush_init(int32_t height); diff --git a/src/hush_notary.h b/src/hush_notary.h index 610407df3..a8f792f8f 100644 --- a/src/hush_notary.h +++ b/src/hush_notary.h @@ -62,6 +62,19 @@ const char *Notaries_genesis[][2] = int32_t gethushseason(int32_t height) { + bool istush = strncmp(SMART_CHAIN_SYMBOL, "TUSH",4) == 0 ? true : false; + if ( istush ) { + // TUSH is always Season 7 DPoW notaries from genblock + return 7; + } + + // It is season 7 until a new consensus code change, instead + // of the old way, which requires a new code release before + // the last season block height or nodes stop working correctly + if ( height > nHushHardforkHeight3 ) { + return 7; + } + if ( height <= HUSH_SEASON_HEIGHTS[0] ) return(1); for (int32_t i = 1; i < NUM_HUSH_SEASONS; i++) @@ -89,6 +102,7 @@ int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; static uint8_t hush_pubkeys[NUM_HUSH_SEASONS][64][33],didinit[NUM_HUSH_SEASONS]; + //HUSH3+TUSH use block heights, HSCs use timestamps if ( timestamp == 0 && SMART_CHAIN_SYMBOL[0] != 0 ) { timestamp = hush_heightstamp(height); } else if ( SMART_CHAIN_SYMBOL[0] == 0 ) { @@ -98,7 +112,9 @@ int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) // Find the correct DPoW Notary pubkeys for this season int32_t hush_season = 0; bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false; - hush_season = ishush3 ? gethushseason(height) : getacseason(timestamp); + bool istush = strncmp(SMART_CHAIN_SYMBOL, "TUSH",4) == 0 ? true : false; + // TUSH uses height activation like HUSH3, other HSCs use timestamps + hush_season = (ishush3 || istush) ? gethushseason(height) : getacseason(timestamp); if(IS_HUSH_NOTARY) { fprintf(stderr,"%s: [%s] season=%d height=%d time=%d\n", __func__, ishush3 ? "HUSH3" : SMART_CHAIN_SYMBOL, hush_season, height, timestamp); @@ -323,14 +339,14 @@ int32_t hush_dpowconfs(int32_t txheight,int32_t numconfs) return(numconfs); } -int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) +int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) { struct notarized_checkpoint *np = 0; if ( (np= komodo_npptr(height)) != 0 ) { *notarized_htp = np->notarized_height; *MoMp = np->MoM; - *kmdtxidp = np->notarized_desttxid; + *hushtxidp = np->notarized_desttxid; *MoMoMp = np->MoMoM; *MoMoMoffsetp = np->MoMoMoffset; *MoMoMdepthp = np->MoMoMdepth; @@ -341,7 +357,7 @@ int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int3 *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0; memset(MoMp,0,sizeof(*MoMp)); memset(MoMoMp,0,sizeof(*MoMoMp)); - memset(kmdtxidp,0,sizeof(*kmdtxidp)); + memset(hushtxidp,0,sizeof(*hushtxidp)); return(0); } diff --git a/src/main.cpp b/src/main.cpp index 0771ffdb5..eabed2626 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1455,8 +1455,9 @@ bool CheckTransaction(uint32_t tiptime,const CTransaction& tx, CValidationState // This is used only in RPC currently but hush_notaries()/gethushseason/getacseason is consensus int32_t hush_isnotaryvout(char *coinaddr,uint32_t tiptime) { bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false; + bool istush = strncmp(SMART_CHAIN_SYMBOL, "TUSH",4) == 0 ? true : false; int32_t height = chainActive.LastTip()->GetHeight(); - int32_t season = ishush3 ? gethushseason(height) : getacseason(tiptime); + int32_t season = (ishush3 || istush) ? gethushseason(height) : getacseason(tiptime); fprintf(stderr,"%s: season=%d, tiptime=%d\n", __func__, season,tiptime); if ( NOTARY_ADDRESSES[season-1][0][0] == 0 ) { uint8_t pubkeys[64][33]; diff --git a/src/rpc/crosschain.cpp b/src/rpc/crosschain.cpp index 45140138b..375bbfbd5 100644 --- a/src/rpc/crosschain.cpp +++ b/src/rpc/crosschain.cpp @@ -56,7 +56,7 @@ int32_t ensure_CCrequirements(uint8_t evalcode); bool EnsureWalletIsAvailable(bool avoidException); -int32_t hush_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip); +int32_t hush_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip); int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height); struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi); uint256 hush_calcMoM(int32_t height,int32_t MoMdepth); @@ -71,7 +71,7 @@ UniValue assetchainproof(const UniValue& params, bool fHelp, const CPubKey& mypk { uint256 hash; - // parse params and get notarisation data for tx + // parse params and get notarization data for tx if ( fHelp || params.size() != 1) throw runtime_error("assetchainproof needs a txid"); @@ -93,7 +93,7 @@ UniValue crosschainproof(const UniValue& params, bool fHelp, const CPubKey& mypk UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk) { - int32_t height,depth,notarized_height,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi; uint256 MoM,MoMoM,kmdtxid; uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR); + int32_t height,depth,notarized_height,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi; uint256 MoM,MoMoM,hushtxid; uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR); if ( fHelp || params.size() != 1 ) throw runtime_error("height_MoM height\n"); LOCK(cs_main); @@ -108,7 +108,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk) height = chainActive.Tip()->GetHeight(); } //fprintf(stderr,"height_MoM height.%d\n",height); - depth = hush_MoM(¬arized_height,&MoM,&kmdtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi); + depth = hush_MoM(¬arized_height,&MoM,&hushtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi); ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL))); ret.push_back(Pair("height",height)); ret.push_back(Pair("timestamp",(uint64_t)timestamp)); @@ -117,7 +117,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk) ret.push_back(Pair("depth",depth)); ret.push_back(Pair("notarized_height",notarized_height)); ret.push_back(Pair("MoM",MoM.GetHex())); - ret.push_back(Pair("kmdtxid",kmdtxid.GetHex())); + ret.push_back(Pair("hushtxid",hushtxid.GetHex())); if ( SMART_CHAIN_SYMBOL[0] != 0 ) { ret.push_back(Pair("MoMoM",MoMoM.GetHex())); @@ -134,18 +134,18 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk) UniValue MoMoMdata(const UniValue& params, bool fHelp, const CPubKey& mypk) { if ( fHelp || params.size() != 3 ) - throw runtime_error("MoMoMdata symbol kmdheight ccid\n"); + throw runtime_error("MoMoMdata symbol hushheight ccid\n"); UniValue ret(UniValue::VOBJ); char* symbol = (char *)params[0].get_str().c_str(); - int kmdheight = atoi(params[1].get_str().c_str()); + int hushheight = atoi(params[1].get_str().c_str()); uint32_t ccid = atoi(params[2].get_str().c_str()); ret.push_back(Pair("coin",symbol)); - ret.push_back(Pair("kmdheight",kmdheight-5)); + ret.push_back(Pair("hushheight",hushheight-5)); ret.push_back(Pair("ccid", (int) ccid)); uint256 destNotarizationTxid; std::vector moms; - uint256 MoMoM = CalculateProofRoot(symbol, ccid, kmdheight-5, moms, destNotarizationTxid); + uint256 MoMoM = CalculateProofRoot(symbol, ccid, hushheight-5, moms, destNotarizationTxid); UniValue valMoms(UniValue::VARR); for (int i=0; i 3) throw runtime_error("scanNotarizationsDB blockHeight symbol [blocksLimit=1440]\n\n" - "Scans notarisationsdb backwards from height for a notarisation" + "Scans notarizationsdb backwards from height for a notarization" " of given symbol"); int height = atoi(params[0].get_str().c_str()); std::string symbol = params[1].get_str().c_str(); diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 8139c93ce..0046d4b7f 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -829,8 +829,10 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms // Others may not have data loaded yet, such as wallet details, but // those RPCs are written defensively to deal with that. Allowing these // few RPCs means we can see our addresses and make private key backups - // while a very long wallet rescan is happening + // while a very long wallet rescan is happening and do other read-only devopz if (pcmd->name != "stop" && pcmd->name != "help" && pcmd->name != "z_listaddresses" && pcmd->name != "z_exportkey" && + pcmd->name != "getNotarizationsForBlock" && pcmd->name != "scanNotarizationsDB" && + pcmd->name != "getnotarysendmany" && pcmd->name != "geterablockheights" && pcmd->name != "getaddressesbyaccount" && pcmd->name != "listaddresses" && pcmd->name != "z_exportwallet" && pcmd->name != "notaries" && pcmd->name != "signmessage" && pcmd->name != "decoderawtransaction" && pcmd->name != "dumpprivkey" && pcmd->name != "getpeerinfo" && pcmd->name != "getnetworkinfo" ) { From 6c0c505eeadc4128380b889758ee6df40b706d98 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 14 Sep 2021 16:03:34 -0400 Subject: [PATCH 03/16] TUSH is alive and well --- src/tush-cli | 17 +++++++++++++++++ src/tushd | 14 ++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 src/tush-cli create mode 100755 src/tushd diff --git a/src/tush-cli b/src/tush-cli new file mode 100755 index 000000000..fa40e9f81 --- /dev/null +++ b/src/tush-cli @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright (c) 2016-2021 The Hush developers + +# set working directory to the location of this script +# readlink -f does not always exist +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $DIR +DIR="$( cd "$( dirname "$( readlink "${BASH_SOURCE[0]}" )" )" && pwd )" +cd $DIR + +NAME=TUSH + +# Use the HUSHCLI env var to over-ride using the same directory as this file +CLI=${HUSHCLI:-./hush-cli} +if [ -f $CLI ]; then + $CLI -ac_name=$NAME "$@" +fi diff --git a/src/tushd b/src/tushd new file mode 100755 index 000000000..ad5fafa21 --- /dev/null +++ b/src/tushd @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Copyright (c) 2016-2021 The Hush developers +# Distributed under the GPLv3 software license, see the accompanying +# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html + +# set working directory to the location of this script +# readlink -f does not always exist +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $DIR +DIR="$( cd "$( dirname "$( readlink "${BASH_SOURCE[0]}" )" )" && pwd )" +cd $DIR + +./hushd -ac_name=TUSH -ac_private=1 -gen=1 -testnode=1 + From 9c67f1b7589795880cd3ba8b9d9405cd35c0a5b7 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 10:23:13 -0400 Subject: [PATCH 04/16] Checkpoints --- contrib/checkpoints.pl | 6 +-- src/chainparams.cpp | 86 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 7 deletions(-) diff --git a/contrib/checkpoints.pl b/contrib/checkpoints.pl index 1a6524820..64f555261 100755 --- a/contrib/checkpoints.pl +++ b/contrib/checkpoints.pl @@ -37,9 +37,9 @@ while (1) { } my $time = qx{$hush getblock $last |grep time|cut -d: -f2| sed 's/,//g'}; chomp($time); -# TODO: This is Linux-only -my $line1 = qx{grep --text height=$prev ~/.komodo/HUSH3/debug.log}; -my $line2 = qx{grep --text height=$blocks ~/.komodo/HUSH3/debug.log}; +# TODO: This is Linux-only and assumes new (not legacy) dir +my $line1 = qx{grep --text height=$prev ~/.hush/HUSH3/debug.log}; +my $line2 = qx{grep --text height=$blocks ~/.hush/HUSH3/debug.log}; my $txs_per_day = 2 * $perday; # default estimate is 2 txs per block, on average my $total_txs = 0; #print "line1: $line1\n"; diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 26f4e8488..df85bdf23 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -882,10 +882,88 @@ void *chainparams_commandline() { (584000, uint256S("0x0000000720f29b0d72469739e9d94607e67b48eb9957b45c2fd5a34b86df039a")) (585000, uint256S("0x00000001409c395b2e37e2b88110b320996996241bfb489103db9e17aaf2ddc7")) (586000, uint256S("0x00000006ff6509d260f66af2fc4fc1769d56394333f3ad5a19bbd10c8c26742b")) - (587000, uint256S("0x00000003866d330ac5448e07eb5e95d2e1860203f2e0ca568161d04ea5c5deb8")), - (int64_t) 1625849524, // time of last checkpointed block - (int64_t) 0, // total txs - (double) 2304 // txs in the last day before block 587157 + (587000, uint256S("0x00000003866d330ac5448e07eb5e95d2e1860203f2e0ca568161d04ea5c5deb8")) + (588000, uint256S("0x0000000247f3b1c8f60b82a1dc5b86ead3adb023a6e3508d1c732c88bceae666")) + (589000, uint256S("0x00000000d9108a0e811622919777fb929986966034bb53678d431dd50f0b3640")) + (590000, uint256S("0x00000006a7699d8fb948cc67dd2427ee25fbfa2a8e02517aad45880658eab983")) + (591000, uint256S("0x00000004f6746a57c60ab45b5d0a30375e635bb8b564c85b92e8b34afbb82077")) + (592000, uint256S("0x000000023987ca4c3454b0fd17fe64febcc2c1b75d2820e0368084c59d71cbb3")) + (593000, uint256S("0x00000006e05b247fa1a4b99e5292d4c696e2627ed5b64263ceb2a985d98cb446")) + (594000, uint256S("0x000000010f20489639e7ec3a3694b2c1def345f2bf7804fadbd1ee92813a020d")) + (595000, uint256S("0x00000008fda549361df97ddac7f495fdb629c4c6a646c91e5535f96d12d98dee")) + (596000, uint256S("0x0000000512d08ea2cd501bb2132dec8dd997e0332e5d0a51bf9d0992451030da")) + (597000, uint256S("0x00000006384749ab79ee12dd46e068634254354c511f535278d54b8efd41e29e")) + (598000, uint256S("0x000000031ba9be6704d352002cfb763dc7123e93911796159ef8d2d0328da348")) + (599000, uint256S("0x00000005bf47be7b949ff5217ae980fcea48d9d25e824c68367ce934447ef0bd")) + (600000, uint256S("0x00000000a721ce253a2c130fec44c581810dfb9448a46ef524a16f1ef3920bec")) + (601000, uint256S("0x00000007cdbdfd7f1c9bf8c20ff4f35c2c25a21558a5e70ea139bd50d2421fab")) + (602000, uint256S("0x0000000708ba8ec93c022184d3258cd4956f82e2edd0b67c2493f74a3bf6afef")) + (603000, uint256S("0x00000005a7b51fd94b80f51ae2b0d0dc8f7285eb418914bd177f6f2fcc68e745")) + (604000, uint256S("0x00000010bd1bce0ed2c83f8860b5201a700c535dfc6d6af2c15ee7de4e2e0cba")) + (605000, uint256S("0x00000002cac498bb995a395d52a41a48372e57b494de023cd4e2eb70c5616b1b")) + (606000, uint256S("0x0000000269e7256e93648c29f72e169767af626c7db95fa8ac853be6072a7942")) + (607000, uint256S("0x000000073e07d2a4757b93641c318dbdc784067b02d4cc9f0be4747c80319f3b")) + (608000, uint256S("0x00000001613776b53c2060529996e64d24fa5874879b7457aee20430ab2bc87f")) + (609000, uint256S("0x0000000acd03e99bfe60d8a5d5023b373aa13f71a5d577c813141b3b714cc95a")) + (610000, uint256S("0x0000000aa64b831908eb621b6e2c548620d29146b0c8dae951dd84daef0e63d1")) + (611000, uint256S("0x0000000736b273fdf7d8df9bddba568e71547a79e0b14c71027e61dae6a83443")) + (612000, uint256S("0x00000012a5b000bcb8606acb628c46d49157bc97189fc8e37dfaaf280b05f8a1")) + (613000, uint256S("0x00000006bb698faba83d28b958cd9a242fa9baadb2efa510e2e27b1eebedb951")) + (614000, uint256S("0x000000007c66271651afb1468d0546f3ea1b9720d42e3597c9277429d43765f1")) + (615000, uint256S("0x00000015a141ae1feec020f529a3e5dea51d29efdef8d0425677e5126c850f73")) + (616000, uint256S("0x0000000967c92b77c884fc58d7973a8d78ea47c2ec8e68e1619f6b92f3db2c05")) + (617000, uint256S("0x0000000a7eb3e594474d545752f35a70965c17e497c2201fa8f38943bebb8756")) + (618000, uint256S("0x0000000ca0f1eb16ed72e5ea4e77cb165fb87384e4c3e0064d5faac7f49c91b9")) + (619000, uint256S("0x00000006da3e4a2e36342593090efb0fdf19e77d4ce8663a54df0dd7109b178b")) + (620000, uint256S("0x0000000d7c987adbdbf3742c6cebd55b7c8fe213362385f1e24e6eecf7dd4ea0")) + (621000, uint256S("0x00000003009cf1ac25864d6997dd9c9ce76cf6cb58f0e61700bb52ec72f54cc6")) + (622000, uint256S("0x0000000cf25b9a537ea61d548979003dde28155b73b26d53cf2a7b69036926cb")) + (623000, uint256S("0x00000007da399943d00f84c9e190e9968f3f456de70060ad17b6b63606287db0")) + (624000, uint256S("0x0000000cab9f7f9e6e5223eda1bee8de7384b6dbed3bfe807818871d78f9594f")) + (625000, uint256S("0x0000000266b471c7ee107a85080792531d7dc91c23d7b42b46e44728c3d9ea8c")) + (626000, uint256S("0x00000003fe1af9fffd32fae9b809c916d7484024021053c09286c763fd2fc1e6")) + (627000, uint256S("0x00000006f9bbef0362e0e99bb4061b4d386c82477d64d84850e4a1b6fce85093")) + (628000, uint256S("0x0000000d9afb9e78eac960bc5b7aaa8356ac6660e5147175117ed53f6d41215e")) + (629000, uint256S("0x000000071ee3b95304b4df78e66c56f8f1deb557b57ed7716c389b0e04344d87")) + (630000, uint256S("0x00000002ed362482e0bc5d03d07e406748590d01871f91e03ed86d15737d1e2f")) + (631000, uint256S("0x0000000e55845a96afa1359c6aaac5e66c84daf56ccea33d9127a66e6162736d")) + (632000, uint256S("0x0000000fb180307499ce6d21f2308ffdf20b0d03ed45ba0de3420fac71434b95")) + (633000, uint256S("0x00000010ddf5569109d8a405eedac88f2ae9f56838dcf279cd9ca32185cf5d55")) + (634000, uint256S("0x0000000781805d9c573380c22215cf83280c4d0688bbd730adb0821c89b2a3d0")) + (635000, uint256S("0x0000000fa1d7aba218223517de8ceeecfcda087b7e549b0537a986465520e040")) + (636000, uint256S("0x00000010eb125169e1e9cbe061564c9c663389b6a68a06445d18c4346601ce78")) + (637000, uint256S("0x0000000c85df82c1ade3c311e5673c294d97858ea23dac5d5f03aaf32b374b1b")) + (638000, uint256S("0x00000002aa16a3abc3ae9739609eddaf805fce5d0f7b0ae8d9494381843ab5a2")) + (639000, uint256S("0x00000012eb63468724acc222e45889a9bf54c1a5e0152ad1fc9c57cdb7bcb460")) + (640000, uint256S("0x0000000bf6a31eec79a36c5423f52069e5d6858bfc566081556ba9487a5ef36f")) + (641000, uint256S("0x000000065414f1d2a543687ee4c0137ca5d66d5d35f9dbf9b4fe73e59ecc5af7")) + (642000, uint256S("0x00000005fe35f60661760b7ca027a73e6915f6add12e736018357a1e782310a4")) + (643000, uint256S("0x000000076e77c3e0a2a1890a5bea2d92aa720a08bb4e5571e76bb05c93f40c98")) + (644000, uint256S("0x0000001054093374a3a414047113ab882d092f012c1c17cf3d98ca8006b8e8bc")) + (645000, uint256S("0x0000000cb0c07c2325e8162e58f3fcc14323450274a1d69aff06ac799cf72f53")) + (646000, uint256S("0x0000000252d31029d2e96406697ada40ca3afb3d9fe2a2f67cdad2462e8fe00d")) + (647000, uint256S("0x0000001155755f0718b6cc3474e44748358e5328c2c0c32c97cfd3842bf22510")) + (648000, uint256S("0x000000173c2e63d658263c1c28e1e0a1b2ce30f2d3d4eba2f540836315a9d5ea")) + (649000, uint256S("0x00000002044331ebe095ea838da367fed1495be4ad69b0c655df653ccb1923dd")) + (650000, uint256S("0x00000010afad2d800c397557a9cbe501f32cd09f18f89c2f3f11e0e38ae45843")) + (651000, uint256S("0x0000000b6a9630f3a2334d4529ba013480104e54fc59dc4cabc3a8869ad17a01")) + (652000, uint256S("0x00000004d22aa00fb4c8266b0304f43bc7bec8e18850e764a431438a9fdfd141")) + (653000, uint256S("0x0000000a248721cef01783838a5b53547b12273ddf57a2bc3ba708ea987f8937")) + (654000, uint256S("0x00000004c95adc9e17e429c35cc4c8ffd130e23228245e29f150896ab66ffdfd")) + (655000, uint256S("0x0000001428523dbe3cf9338753a42c579a669df7bbd8d6fa667f4daf2c4c749f")) + (656000, uint256S("0x0000001704429a9b902d4cddee708bd0ae7b758c6bd9ed634c143931e15ac337")) + (657000, uint256S("0x00000007b376e2c197b21a2eacac81847f401f92ed50213e845e039d3516458c")) + (658000, uint256S("0x00000026e751010b1135052b105f2be464702b040d76610bfeae1b1a2bcab15c")) + (659000, uint256S("0x00000005d784a9cf7b60bc6908234052c29a555dcf1d4f8a82663aabbc2e0c83")) + (660000, uint256S("0x00000015cdf576c284ad93912955194f6764a16d562308bb82bcfdc7a27ad20b")) + (661000, uint256S("0x0000000af126a5261626bc10a6cf2a8a07ea145f6aa33539e4d434033411c4db")) + (662000, uint256S("0x00000011c4659f0bbe3559c32ff24588d78a3822e8b0e31bb9298a16213fe154")) + (663000, uint256S("0x000000076756708535e3daeaca6bc32aa1dc360228af6a0c5e5e07b5d9f5f00b")) + (664000, uint256S("0x000000181806c17b47bb843537cc91c95ca1e3596bb9e049d18c2e73c1026258")) + (665000, uint256S("0x0000001e966c9edae76c40262e65a6c9ab764a09154eb802fb892ceebc2d1935")), + (int64_t) 1631750258, // time of last checkpointed block + (int64_t) 1064407, // total txs + (double) 1402 // txs in the last day before block 665685 }; } else { checkpointData = //(Checkpoints::CCheckpointData) From f21065394f4e1071fc5be3faca66910ae64af8a8 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 10:25:23 -0400 Subject: [PATCH 05/16] Update dapp header file location and error message --- src/cc/dapps/dappstd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cc/dapps/dappstd.c b/src/cc/dapps/dappstd.c index 1d897196b..67cb6b9cb 100644 --- a/src/cc/dapps/dappstd.c +++ b/src/cc/dapps/dappstd.c @@ -246,9 +246,9 @@ int32_t safecopy(char *dest,char *src,long len) #define true 1 #define false 0 //#ifdef STANDALONE -//#include "../komodo/src/komodo_cJSON.c" +//#include "../hush3/src/hush_cJSON.c" //#else -#include "../komodo_cJSON.c" +#include "../hush_cJSON.c" //#endif int32_t games_replay(uint64_t seed,int32_t sleeptime); @@ -1105,7 +1105,7 @@ int main(int argc, char **argv) fclose(fp); if ( GAMES_PORT == 0 ) { - printf("you must copy %s.conf from ~/.komodo/%s/%s.conf (or equivalent location) to current dir\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_SYMBOL,ASSETCHAINS_SYMBOL); + printf("you must copy %s.conf from ~/.hush/%s/%s.conf (or equivalent location) to current dir\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_SYMBOL,ASSETCHAINS_SYMBOL); return(-1); } return(GAMEMAIN(argc,argv)); From f22cbbf1e21d73ab931d41993ec8800264c7c14e Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 14:12:31 -0400 Subject: [PATCH 06/16] Cleanup and remove dead code --- src/bitcoind.cpp | 2 +- src/cc/CCPrices.h | 2 +- src/cc/CC_made_easy.md | 4 +- src/cc/cclib.cpp | 2 +- src/cc/gamescc.cpp | 6 +- src/hush.h | 14 +- src/hush_bitcoind.h | 14 +- src/hush_cJSON.h | 4 +- src/hush_ccdata.h | 24 +-- src/hush_defs.h | 24 +-- src/hush_events.h | 26 +-- src/hush_gateway.h | 386 +++++++++++++++++++------------------- src/hush_globals.h | 8 +- src/hush_nSPV_fullnode.h | 2 +- src/hush_nSPV_superlite.h | 8 +- src/hush_notary.h | 14 +- src/hush_pax.h | 18 +- src/hush_structs.h | 4 +- src/hush_utils.h | 8 +- src/main.cpp | 18 +- src/miner.cpp | 20 +- src/rpc/blockchain.cpp | 6 +- src/rpc/crosschain.cpp | 4 +- src/rpc/mining.cpp | 2 +- src/wallet/rpcwallet.cpp | 22 +-- 25 files changed, 321 insertions(+), 321 deletions(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 9ba1b93ae..9e5a2b43a 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -69,7 +69,7 @@ void WaitForShutdown(boost::thread_group* threadGroup) // Tell the main threads to shutdown. if ( ASSETCHAINS_CBOPRET != 0 ) { - komodo_pricesinit(); + hush_pricesinit(); } while (!fShutdown) diff --git a/src/cc/CCPrices.h b/src/cc/CCPrices.h index 5b352d0f6..e715706b9 100644 --- a/src/cc/CCPrices.h +++ b/src/cc/CCPrices.h @@ -23,7 +23,7 @@ #include "hush_defs.h" #include "CCinclude.h" -int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks); +int32_t hush_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks); extern void GetHushEarlytxidScriptPub(); extern CScript HUSH_EARLYTXID_SCRIPTPUB; diff --git a/src/cc/CC_made_easy.md b/src/cc/CC_made_easy.md index 48ccde25a..149c5321c 100644 --- a/src/cc/CC_made_easy.md +++ b/src/cc/CC_made_easy.md @@ -84,7 +84,7 @@ However, this is the CC contract basics chapter, so let us ignore mempool issues That means to just follow a known working template and only changing the things where the existing templates are not sufficient, ie. the core differentiator of your CC contract. -In the ~/komodo/src/cc/eval.h file all the eval codes are defined, currently: +In the hush3/src/cc/eval.h file all the eval codes are defined, currently: #define FOREACH_EVAL(EVAL) \ EVAL(EVAL_IMPORTPAYOUT, 0xe1) \ @@ -201,7 +201,7 @@ You do need to be careful not to cause a deadlock as the CC validation code is c Chapter 6 - faucet example Finally, we are ready for the first actual example of a CC contract. The faucet. This is a very simple contract and it ran into some interesting bugs in the first incarnation. -The code in ~/komodo/src/cc/faucet.cpp is the ultimate documentation for it with all the details, so I will just address the conceptual issues here. +The code in hush3/src/cc/faucet.cpp is the ultimate documentation for it with all the details, so I will just address the conceptual issues here. The idea is that people send funds to the faucet by locking it in faucet's global CC address and anybody is allowed to create a faucetget transaction that spends it. diff --git a/src/cc/cclib.cpp b/src/cc/cclib.cpp index c1ae646ca..30df42f3a 100644 --- a/src/cc/cclib.cpp +++ b/src/cc/cclib.cpp @@ -47,7 +47,7 @@ std::string MYCCLIBNAME = (char *)"sudoku"; #endif #ifndef BUILD_GAMESCC -void komodo_netevent(std::vector payload) {} +void hush_netevent(std::vector payload) {} #endif extern std::string MYCCLIBNAME; diff --git a/src/cc/gamescc.cpp b/src/cc/gamescc.cpp index e2d563d00..80251819f 100644 --- a/src/cc/gamescc.cpp +++ b/src/cc/gamescc.cpp @@ -479,7 +479,7 @@ int32_t games_event(uint32_t timestamp,uint256 gametxid,int32_t eventid,std::vec { GetOpReturnData(games_eventopret(timestamp,mypk,sig,payload),vopret); games_payloadrecv(mypk,timestamp,payload); - komodo_sendmessage(4,8,"events",vopret); + hush_sendmessage(4,8,"events",vopret); return(0); } fprintf(stderr,"games_eventsign error\n"); @@ -539,7 +539,7 @@ UniValue games_events(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) return(result); } -void komodo_netevent(std::vector message) +void hush_netevent(std::vector message) { int32_t i,retval,lag,lagerr=0; uint32_t timestamp,now; CPubKey pk; std::vector sig,payload; char str[67]; if ( games_eventdecode(timestamp,pk,sig,payload,message) == 'E' ) @@ -560,7 +560,7 @@ void komodo_netevent(std::vector message) if ( (rand() % 10) == 0 ) { //fprintf(stderr,"relay message.[%d]\n",(int32_t)message.size()); - komodo_sendmessage(2,2,"events",message); + hush_sendmessage(2,2,"events",message); } } } diff --git a/src/hush.h b/src/hush.h index b25dcfcb4..63bbf3dbe 100644 --- a/src/hush.h +++ b/src/hush.h @@ -146,7 +146,7 @@ int32_t hush_parsestatefile(struct hush_state *sp,FILE *fp,char *symbol,char *de errs++; //if ( matched != 0 ) global independent states -> inside *sp //printf("%s.%d load[%s] ht.%d\n",SMART_CHAIN_SYMBOL,ht,symbol,kheight); - hush_eventadd_kmdheight(sp,symbol,ht,kheight,0); + hush_eventadd_hushheight(sp,symbol,ht,kheight,0); } else if ( func == 'T' ) { @@ -157,7 +157,7 @@ int32_t hush_parsestatefile(struct hush_state *sp,FILE *fp,char *symbol,char *de errs++; //if ( matched != 0 ) global independent states -> inside *sp //printf("%s.%d load[%s] ht.%d t.%u\n",SMART_CHAIN_SYMBOL,ht,symbol,kheight,ktimestamp); - hush_eventadd_kmdheight(sp,symbol,ht,kheight,ktimestamp); + hush_eventadd_hushheight(sp,symbol,ht,kheight,ktimestamp); } else if ( func == 'R' ) { @@ -285,7 +285,7 @@ int32_t hush_parsestatefiledata(struct hush_state *sp,uint8_t *filedata,long *fp int32_t kheight; if ( memread(&kheight,sizeof(kheight),filedata,&fpos,datalen) != sizeof(kheight) ) errs++; - hush_eventadd_kmdheight(sp,symbol,ht,kheight,0); + hush_eventadd_hushheight(sp,symbol,ht,kheight,0); } else if ( func == 'T' ) { @@ -296,7 +296,7 @@ int32_t hush_parsestatefiledata(struct hush_state *sp,uint8_t *filedata,long *fp errs++; //if ( matched != 0 ) global independent states -> inside *sp //printf("%s.%d load[%s] ht.%d t.%u\n",SMART_CHAIN_SYMBOL,ht,symbol,kheight,ktimestamp); - hush_eventadd_kmdheight(sp,symbol,ht,kheight,ktimestamp); + hush_eventadd_hushheight(sp,symbol,ht,kheight,ktimestamp); } else if ( func == 'R' ) { @@ -409,7 +409,7 @@ void hush_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotarie if ( fwrite(&HUSHheight,1,sizeof(HUSHheight),fp) != sizeof(HUSHheight) ) errs++; } - hush_eventadd_kmdheight(sp,symbol,height,HUSHheight,HUSHtimestamp); + hush_eventadd_hushheight(sp,symbol,height,HUSHheight,HUSHtimestamp); } else if ( opretbuf != 0 && opretlen > 0 ) { uint16_t olen = opretlen; fputc('R',fp); @@ -711,7 +711,7 @@ int32_t hush_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notaryi else if ( matched != 0 && i == 0 && j == 1 && opretlen == 149 ) { if ( notaryid >= 0 && notaryid < 64 ) - komodo_paxpricefeed(height,&scriptbuf[len],opretlen); + hush_paxpricefeed(height,&scriptbuf[len],opretlen); } else if ( matched != 0 ) { @@ -792,7 +792,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block) if ( pindex->GetHeight() != hwmheight ) { printf("%s hwmheight.%d vs pindex->GetHeight().%d t.%u reorg.%d\n",SMART_CHAIN_SYMBOL,hwmheight,pindex->GetHeight(),(uint32_t)pindex->nTime,hwmheight-pindex->GetHeight()); - komodo_purge_ccdata((int32_t)pindex->GetHeight()); + hush_purge_ccdata((int32_t)pindex->GetHeight()); hwmheight = pindex->GetHeight(); } if (!fJustCheck) diff --git a/src/hush_bitcoind.h b/src/hush_bitcoind.h index e2b4e9fa7..df299d6dd 100644 --- a/src/hush_bitcoind.h +++ b/src/hush_bitcoind.h @@ -950,12 +950,12 @@ int32_t hush_nextheight() else return(hush_longestchain() + 1); } -int32_t hush_isrealtime(int32_t *kmdheightp) +int32_t hush_isrealtime(int32_t *hushheightp) { struct hush_state *sp; CBlockIndex *pindex; if ( (sp= hush_stateptrget((char *)"HUSH3")) != 0 ) - *kmdheightp = sp->CURRENT_HEIGHT; - else *kmdheightp = 0; + *hushheightp = sp->CURRENT_HEIGHT; + else *hushheightp = 0; if ( (pindex= chainActive.LastTip()) != 0 && pindex->GetHeight() >= (int32_t)hush_longestchain() ) return(1); else return(0); @@ -1212,7 +1212,7 @@ void hush_segids(uint8_t *hashbuf,int32_t height,int32_t n) } } -arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime) +arith_uint256 hush_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime) { arith_uint256 origtarget,easy; int32_t diff,tipdiff; int64_t mult; bool fNegative,fOverflow; CBlockIndex *tipindex; if ( height > 10 && (tipindex= hush_chainactive(height - 1)) != 0 ) // disable offchain diffchange @@ -1238,7 +1238,7 @@ arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,ui return(bnTarget); } -arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc) +arith_uint256 hush_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc) { int32_t oldflag = 0,dispflag = 0; CBlockIndex *pindex; arith_uint256 easydiff,bnTarget,hashval,sum,ave; bool fNegative,fOverflow; int32_t i,n,m,ht,percPoS,diff,val; @@ -1543,7 +1543,7 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height) return(0); } -bool komodo_appendACscriptpub() +bool hush_appendACscriptpub() { static bool didinit = false; if ( didinit ) @@ -1638,7 +1638,7 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height) if ( ASSETCHAINS_SCRIPTPUB.size() > 1 ) { static bool didinit = false; - if ( !didinit && height > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && komodo_appendACscriptpub() ) + if ( !didinit && height > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() ) { fprintf(stderr, "appended CC_op_return to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str()); didinit = true; diff --git a/src/hush_cJSON.h b/src/hush_cJSON.h index f83e1896d..d7eb3a4dd 100644 --- a/src/hush_cJSON.h +++ b/src/hush_cJSON.h @@ -36,8 +36,8 @@ * Removal or modification of this copyright notice is prohibited. * * * ******************************************************************************/ -#ifndef komodo_cJSON__h -#define komodo_cJSON__h +#ifndef hush_cJSON__h +#define hush_cJSON__h #include #include #include diff --git a/src/hush_ccdata.h b/src/hush_ccdata.h index e5e431219..420a7243e 100644 --- a/src/hush_ccdata.h +++ b/src/hush_ccdata.h @@ -41,7 +41,7 @@ uint256 hush_calcMoM(int32_t height,int32_t MoMdepth) return BuildMerkleTree(&fMutated, leaves, tree); } -struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi) +struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi) { struct hush_ccdata_entry *allMoMs=0; struct hush_ccdata *ccdata,*tmpptr; int32_t i,num,max; bool fMutated; std::vector tree, leaves; @@ -58,7 +58,7 @@ struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t k } allMoMs[num].MoM = ccdata->MoMdata.MoM; allMoMs[num].notarized_height = ccdata->MoMdata.notarized_height; - allMoMs[num].kmdheight = ccdata->MoMdata.height; + allMoMs[num].hushheight = ccdata->MoMdata.height; allMoMs[num].txi = ccdata->MoMdata.txi; strcpy(allMoMs[num].symbol,ccdata->symbol); num++; @@ -81,7 +81,7 @@ struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t k return(allMoMs); } -int32_t komodo_addpair(struct hush_ccdataMoMoM *mdata,int32_t notarized_height,int32_t offset,int32_t maxpairs) +int32_t hush_addpair(struct hush_ccdataMoMoM *mdata,int32_t notarized_height,int32_t offset,int32_t maxpairs) { if ( maxpairs >= 0) { if ( mdata->numpairs >= maxpairs ) @@ -91,7 +91,7 @@ int32_t komodo_addpair(struct hush_ccdataMoMoM *mdata,int32_t notarized_height,i //fprintf(stderr,"pairs reallocated to %p num.%d\n",mdata->pairs,mdata->numpairs); } } else { - fprintf(stderr,"komodo_addpair.maxpairs %d must be >= 0\n",(int32_t)maxpairs); + fprintf(stderr,"hush_addpair.maxpairs %d must be >= 0\n",(int32_t)maxpairs); return(-1); } mdata->pairs[mdata->numpairs].notarized_height = notarized_height; @@ -100,7 +100,7 @@ int32_t komodo_addpair(struct hush_ccdataMoMoM *mdata,int32_t notarized_height,i return(maxpairs); } -int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height) +int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t hushheight,int32_t notarized_height) { uint8_t hexdata[8192]; struct hush_ccdata *ccdata,*tmpptr; int32_t len,maxpairs,i,retval=-1,depth,starti,endi,CCid=0; struct hush_ccdata_entry *allMoMs; starti = endi = depth = len = maxpairs = 0; @@ -114,7 +114,7 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda portable_mutex_lock(&HUSH_CC_mutex); DL_FOREACH_SAFE(CC_data,ccdata,tmpptr) { - if ( ccdata->MoMdata.height < kmdheight ) + if ( ccdata->MoMdata.height < hushheight ) { //fprintf(stderr,"%s notarized.%d kmd.%d\n",ccdata->symbol,ccdata->MoMdata.notarized_height,ccdata->MoMdata.height); if ( strcmp(ccdata->symbol,symbol) == 0 ) @@ -140,13 +140,13 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda mdata->kmdendi = endi; if ( starti != 0 && endi != 0 && endi >= starti ) { - if ( (allMoMs= komodo_allMoMs(&depth,&mdata->MoMoM,starti,endi)) != 0 ) + if ( (allMoMs= hush_allMoMs(&depth,&mdata->MoMoM,starti,endi)) != 0 ) { mdata->MoMoMdepth = depth; for (i=0; inumpairs > 0 ) { @@ -160,7 +160,7 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda { if ( len + sizeof(uint32_t)*2 > sizeof(hexdata) ) { - fprintf(stderr,"%s %d %d i.%d of %d exceeds hexdata.%d\n",symbol,kmdheight,notarized_height,i,mdata->numpairs,(int32_t)sizeof(hexdata)); + fprintf(stderr,"%s %d %d i.%d of %d exceeds hexdata.%d\n",symbol,hushheight,notarized_height,i,mdata->numpairs,(int32_t)sizeof(hexdata)); break; } len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->pairs[i].notarized_height); @@ -171,7 +171,7 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda init_hexbytes_noT(hexstr,hexdata,len); //fprintf(stderr,"hexstr.(%s)\n",hexstr); retval = 0; - } else fprintf(stderr,"%s %d %d too much hexdata[%d] for hexstr[%d]\n",symbol,kmdheight,notarized_height,len,hexsize); + } else fprintf(stderr,"%s %d %d too much hexdata[%d] for hexstr[%d]\n",symbol,hushheight,notarized_height,len,hexsize); } free(allMoMs); } @@ -179,7 +179,7 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda return(retval); } -void komodo_purge_ccdata(int32_t height) +void hush_purge_ccdata(int32_t height) { struct hush_ccdata *ccdata,*tmpptr; if ( SMART_CHAIN_SYMBOL[0] == 0 ) @@ -247,7 +247,7 @@ int32_t hush_rwccdata(char *thischain,int32_t rwflag,struct hush_ccdata *ccdata, { for (i=0; inumpairs; i++) { - if ( (np= komodo_npptr(MoMoMdata->pairs[i].notarized_height)) != 0 ) + if ( (np= hush_npptr(MoMoMdata->pairs[i].notarized_height)) != 0 ) { memset(&zero,0,sizeof(zero)); if ( memcmp(&np->MoMoM,&zero,sizeof(np->MoMoM)) == 0 ) diff --git a/src/hush_defs.h b/src/hush_defs.h index c88abe9d6..4d8bd62b8 100644 --- a/src/hush_defs.h +++ b/src/hush_defs.h @@ -594,7 +594,7 @@ extern int32_t ASSETCHAINS_EARLYTXIDCONTRACT; int tx_height( const uint256 &hash ); extern std::vector vAllowListAddress; extern std::map mapHeightEvalActivate; -void komodo_netevent(std::vector payload); +void hush_netevent(std::vector payload); int32_t getacseason(uint32_t timestamp); int32_t gethushseason(int32_t height); @@ -603,8 +603,8 @@ int32_t gethushseason(int32_t height); #define HUSH_KVBINARY 2 #define PRICES_SMOOTHWIDTH 1 #define PRICES_MAXDATAPOINTS 8 -uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume); -int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel); +uint64_t hush_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume); +int32_t hush_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel); int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len); int32_t hush_minerids(uint8_t *minerids,int32_t height,int32_t width); @@ -615,22 +615,22 @@ int32_t hush_longestchain(); int32_t hush_dpowconfs(int32_t height,int32_t numconfs); int8_t hush_segid(int32_t nocache,int32_t height); int32_t hush_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeight); -char *komodo_pricename(char *name,int32_t ind); -int32_t komodo_priceind(const char *symbol); -int32_t komodo_pricesinit(); -int64_t komodo_priceave(int64_t *tmpbuf,int64_t *correlated,int32_t cskip); -int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t rawskip,uint32_t *nonzprices,int32_t smoothwidth); +char *hush_pricename(char *name,int32_t ind); +int32_t hush_priceind(const char *symbol); +int32_t hush_pricesinit(); +int64_t hush_priceave(int64_t *tmpbuf,int64_t *correlated,int32_t cskip); +int64_t hush_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t rawskip,uint32_t *nonzprices,int32_t smoothwidth); int32_t hush_nextheight(); uint32_t hush_heightstamp(int32_t height); -int64_t komodo_pricemult(int32_t ind); -int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks); +int64_t hush_pricemult(int32_t ind); +int32_t hush_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks); int32_t hush_currentheight(); int32_t hush_notarized_bracket(struct notarized_checkpoint *nps[2],int32_t height); -arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime); +arith_uint256 hush_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime); bool hush_hardfork_active(uint32_t time); uint256 Parseuint256(const char *hexstr); -void komodo_sendmessage(int32_t minpeers, int32_t maxpeers, const char *message, std::vector payload); +void hush_sendmessage(int32_t minpeers, int32_t maxpeers, const char *message, std::vector payload); CBlockIndex *hush_getblockindex(uint256 hash); int32_t hush_nextheight(); CBlockIndex *hush_blockindex(uint256 hash); diff --git a/src/hush_events.h b/src/hush_events.h index 6d733483d..00832ae23 100644 --- a/src/hush_events.h +++ b/src/hush_events.h @@ -88,7 +88,7 @@ void hush_eventadd_pricefeed(struct hush_state *sp,char *symbol,int32_t height,u memcpy(F.prices,prices,sizeof(*F.prices) * num); hush_eventadd(sp,height,symbol,HUSH_EVENT_PRICEFEED,(uint8_t *)&F,(int32_t)(sizeof(F.num) + sizeof(*F.prices) * num)); if ( sp != 0 ) - komodo_pvals(height,prices,num); + hush_pvals(height,prices,num); } //else fprintf(stderr,"skip pricefeed[%d]\n",num); } @@ -107,7 +107,7 @@ void hush_eventadd_opreturn(struct hush_state *sp,char *symbol,int32_t height,ui hush_eventadd(sp,height,symbol,HUSH_EVENT_OPRETURN,opret,O.oplen); free(opret); if ( sp != 0 ) - komodo_opreturn(height,value,buf,opretlen,txid,vout,symbol); + hush_opreturn(height,value,buf,opretlen,txid,vout,symbol); } } @@ -155,32 +155,32 @@ void hush_event_rewind(struct hush_state *sp,char *symbol,int32_t height) } } -void komodo_setkmdheight(struct hush_state *sp,int32_t kmdheight,uint32_t timestamp) +void hush_sethushheight(struct hush_state *sp,int32_t hushheight,uint32_t timestamp) { if ( sp != 0 ) { - if ( kmdheight > sp->SAVEDHEIGHT ) + if ( hushheight > sp->SAVEDHEIGHT ) { - sp->SAVEDHEIGHT = kmdheight; + sp->SAVEDHEIGHT = hushheight; sp->SAVEDTIMESTAMP = timestamp; } - if ( kmdheight > sp->CURRENT_HEIGHT ) - sp->CURRENT_HEIGHT = kmdheight; + if ( hushheight > sp->CURRENT_HEIGHT ) + sp->CURRENT_HEIGHT = hushheight; } } -void hush_eventadd_kmdheight(struct hush_state *sp,char *symbol,int32_t height,int32_t kmdheight,uint32_t timestamp) +void hush_eventadd_hushheight(struct hush_state *sp,char *symbol,int32_t height,int32_t hushheight,uint32_t timestamp) { uint32_t buf[2]; - if ( kmdheight > 0 ) { - buf[0] = (uint32_t)kmdheight; + if ( hushheight > 0 ) { + buf[0] = (uint32_t)hushheight; buf[1] = timestamp; hush_eventadd(sp,height,symbol,HUSH_EVENT_HUSHHEIGHT,(uint8_t *)buf,sizeof(buf)); if ( sp != 0 ) - komodo_setkmdheight(sp,kmdheight,timestamp); + hush_sethushheight(sp,hushheight,timestamp); } else { - //fprintf(stderr,"REWIND kmdheight.%d\n",kmdheight); - kmdheight = -kmdheight; + //fprintf(stderr,"REWIND hushheight.%d\n",hushheight); + hushheight = -hushheight; hush_eventadd(sp,height,symbol,HUSH_EVENT_REWIND,(uint8_t *)&height,sizeof(height)); if ( sp != 0 ) hush_event_rewind(sp,symbol,height); diff --git a/src/hush_gateway.h b/src/hush_gateway.h index ddaf366a2..b52ab8a1e 100644 --- a/src/hush_gateway.h +++ b/src/hush_gateway.h @@ -45,7 +45,7 @@ int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued, if ( sp->withdrawn > maxval ) maxval = sp->withdrawn; netliability = (sp->issued - maxval) - sp->shorted; - maxallowed = komodo_maxallowed(baseid); + maxallowed = hush_maxallowed(baseid); if ( netliability < maxallowed ) *available = (maxallowed - netliability); //printf("%llu - %llu %s %.8f %.8f %.8f %.8f %.8f\n",(long long)maxallowed,(long long)netliability,base,dstr(*deposited),dstr(*issued),dstr(*withdrawn),dstr(*approved),dstr(*redeemed)); @@ -62,7 +62,7 @@ void pax_keyset(uint8_t *buf,uint256 txid,uint16_t vout,uint8_t type) buf[34] = type; } -struct pax_transaction *komodo_paxfind(uint256 txid,uint16_t vout,uint8_t type) +struct pax_transaction *hush_paxfind(uint256 txid,uint16_t vout,uint8_t type) { struct pax_transaction *pax; uint8_t buf[35]; pthread_mutex_lock(&hush_mutex); @@ -72,16 +72,16 @@ struct pax_transaction *komodo_paxfind(uint256 txid,uint16_t vout,uint8_t type) return(pax); } -struct pax_transaction *komodo_paxfinds(uint256 txid,uint16_t vout) +struct pax_transaction *hush_paxfinds(uint256 txid,uint16_t vout) { struct pax_transaction *pax; int32_t i; uint8_t types[] = { 'I', 'D', 'X', 'A', 'W' }; for (i=0; imarked = mark; //if ( height > 214700 || pax->height > 214700 ) - // printf("mark ht.%d %.8f %.8f\n",pax->height,dstr(pax->komodoshis),dstr(pax->fiatoshis)); + // printf("mark ht.%d %.8f %.8f\n",pax->height,dstr(pax->puposhis),dstr(pax->fiatoshis)); } pthread_mutex_unlock(&hush_mutex); return(pax); } -void komodo_paxdelete(struct pax_transaction *pax) +void hush_paxdelete(struct pax_transaction *pax) { return; // breaks when out of order pthread_mutex_lock(&hush_mutex); @@ -116,7 +116,7 @@ void komodo_paxdelete(struct pax_transaction *pax) pthread_mutex_unlock(&hush_mutex); } -void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t fiatoshis,uint8_t *rmd160,uint256 txid,uint16_t vout,uint8_t type,int32_t height,int32_t otherheight,char *source,int32_t approved) // assetchain context +void hush_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t fiatoshis,uint8_t *rmd160,uint256 txid,uint16_t vout,uint8_t type,int32_t height,int32_t otherheight,char *source,int32_t approved) // assetchain context { struct pax_transaction *pax; uint8_t buf[35]; int32_t addflag = 0; struct hush_state *sp; char str[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN],*s; //if ( HUSH_PAX == 0 ) @@ -148,7 +148,7 @@ void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t { strcpy(pax->coinaddr,coinaddr); if ( value != 0 ) - pax->komodoshis = value; + pax->puposhis = value; if ( symbol != 0 ) strcpy(pax->symbol,symbol); if ( source != 0 ) @@ -169,7 +169,7 @@ void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t } } -int32_t komodo_rwapproval(int32_t rwflag,uint8_t *opretbuf,struct pax_transaction *pax) +int32_t hush_rwapproval(int32_t rwflag,uint8_t *opretbuf,struct pax_transaction *pax) { int32_t i,len = 0; if ( rwflag == 1 ) @@ -189,7 +189,7 @@ int32_t komodo_rwapproval(int32_t rwflag,uint8_t *opretbuf,struct pax_transactio pax->vout += ((uint32_t)opretbuf[len++] << 8); //printf(" txid v.%d\n",pax->vout); } - len += dragon_rwnum(rwflag,&opretbuf[len],sizeof(pax->komodoshis),&pax->komodoshis); + len += dragon_rwnum(rwflag,&opretbuf[len],sizeof(pax->puposhis),&pax->puposhis); len += dragon_rwnum(rwflag,&opretbuf[len],sizeof(pax->fiatoshis),&pax->fiatoshis); len += dragon_rwnum(rwflag,&opretbuf[len],sizeof(pax->height),&pax->height); len += dragon_rwnum(rwflag,&opretbuf[len],sizeof(pax->otherheight),&pax->otherheight); @@ -208,7 +208,7 @@ int32_t komodo_rwapproval(int32_t rwflag,uint8_t *opretbuf,struct pax_transactio return(len); } -int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t *values,int64_t *srcvalues,int32_t *kmdheights,int32_t *otherheights,int8_t *baseids,uint8_t *rmd160s,uint8_t *opretbuf,int32_t opretlen,int32_t iskomodo) +int32_t hush_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t *values,int64_t *srcvalues,int32_t *hushheights,int32_t *otherheights,int8_t *baseids,uint8_t *rmd160s,uint8_t *opretbuf,int32_t opretlen,int32_t iskomodo) { struct pax_transaction p,*pax; int32_t i,n=0,j,len=0,incr,height,otherheight; uint8_t type,rmd160[20]; uint64_t fiatoshis; char symbol[HUSH_SMART_CHAIN_MAXLEN]; //if ( HUSH_PAX == 0 ) @@ -231,14 +231,14 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t if ( iskomodo != 0 ) { memset(&p,0,sizeof(p)); - len += komodo_rwapproval(0,&opretbuf[len],&p); - if ( values != 0 && srcvalues != 0 && kmdheights != 0 && otherheights != 0 && baseids != 0 && rmd160s != 0 ) + len += hush_rwapproval(0,&opretbuf[len],&p); + if ( values != 0 && srcvalues != 0 && hushheights != 0 && otherheights != 0 && baseids != 0 && rmd160s != 0 ) { txids[n] = p.txid; vouts[n] = p.vout; - values[n] = (strcmp("HUSH3",base) == 0) ? p.komodoshis : p.fiatoshis; - srcvalues[n] = (strcmp("HUSH3",base) == 0) ? p.fiatoshis : p.komodoshis; - kmdheights[n] = p.height; + values[n] = (strcmp("HUSH3",base) == 0) ? p.puposhis : p.fiatoshis; + srcvalues[n] = (strcmp("HUSH3",base) == 0) ? p.fiatoshis : p.puposhis; + hushheights[n] = p.height; otherheights[n] = p.otherheight; memcpy(&rmd160s[n * 20],p.rmd160,20); baseids[n] = hush_baseid(p.source); @@ -246,7 +246,7 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t { char coinaddr[64]; bitcoin_address(coinaddr,60,&rmd160s[n * 20],20); - printf(">>>>>>> %s: (%s) fiat %.8f kmdheight.%d other.%d -> %s %.8f\n",type=='A'?"approvedA":"issuedX",baseids[n]>=0?CURRENCIES[baseids[n]]:"???",dstr(p.fiatoshis),kmdheights[n],otherheights[n],coinaddr,dstr(values[n])); + printf(">>>>>>> %s: (%s) fiat %.8f hushheight.%d other.%d -> %s %.8f\n",type=='A'?"approvedA":"issuedX",baseids[n]>=0?CURRENCIES[baseids[n]]:"???",dstr(p.fiatoshis),hushheights[n],otherheights[n],coinaddr,dstr(values[n])); } } } @@ -262,22 +262,22 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t vouts[n] = opretbuf[len++]; vouts[n] = (opretbuf[len++] << 8) | vouts[n]; baseids[n] = hush_baseid(base); - if ( (pax= komodo_paxfinds(txids[n],vouts[n])) != 0 ) + if ( (pax= hush_paxfinds(txids[n],vouts[n])) != 0 ) { - values[n] = (strcmp("HUSH3",base) == 0) ? pax->komodoshis : pax->fiatoshis; - srcvalues[n] = (strcmp("HUSH3",base) == 0) ? pax->fiatoshis : pax->komodoshis; - kmdheights[n] = pax->height; + values[n] = (strcmp("HUSH3",base) == 0) ? pax->puposhis : pax->fiatoshis; + srcvalues[n] = (strcmp("HUSH3",base) == 0) ? pax->fiatoshis : pax->puposhis; + hushheights[n] = pax->height; otherheights[n] = pax->otherheight; memcpy(&rmd160s[n * 20],pax->rmd160,20); } } - //printf(" komodo_issued_opreturn issuedtxid v%d i.%d opretlen.%d\n",vouts[n],n,opretlen); + //printf(" hush_issued_opreturn issuedtxid v%d i.%d opretlen.%d\n",vouts[n],n,opretlen); } } return(n); } -int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t checkvalue,uint64_t seed) +int32_t hush_paxcmp(char *symbol,int32_t hushheight,uint64_t value,uint64_t checkvalue,uint64_t seed) { int32_t ratio; if ( seed == 0 && checkvalue != 0 ) @@ -288,7 +288,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che else { if ( SMART_CHAIN_SYMBOL[0] != 0 ) - printf("ht.%d ignore mismatched %s value %lld vs checkvalue %lld -> ratio.%d\n",kmdheight,symbol,(long long)value,(long long)checkvalue,ratio); + printf("ht.%d ignore mismatched %s value %lld vs checkvalue %lld -> ratio.%d\n",hushheight,symbol,(long long)value,(long long)checkvalue,ratio); return(-1); } } @@ -301,7 +301,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che return(value != checkvalue); } -uint64_t komodo_paxtotal() +uint64_t hush_paxtotal() { struct pax_transaction *pax,*pax2,*tmp,*tmp2; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN],*str; int32_t i,ht; int64_t checktoshis; uint64_t seed,total = 0; struct hush_state *basesp; if ( HUSH_PASSPORT_INITDONE == 0 ) //HUSH_PAX == 0 || @@ -320,16 +320,16 @@ uint64_t komodo_paxtotal() basesp = hush_stateptrget(str); if ( basesp != 0 && pax->didstats == 0 ) { - if ( pax->type == 'I' && (pax2= komodo_paxfind(pax->txid,pax->vout,'D')) != 0 ) + if ( pax->type == 'I' && (pax2= hush_paxfind(pax->txid,pax->vout,'D')) != 0 ) { if ( pax2->fiatoshis != 0 ) { - pax->komodoshis = pax2->komodoshis; + pax->puposhis = pax2->puposhis; pax->fiatoshis = pax2->fiatoshis; basesp->issued += pax->fiatoshis; pax->didstats = 1; if ( strcmp(str,SMART_CHAIN_SYMBOL) == 0 ) - printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,str,dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); + printf("########### %p issued %s += %.8f hushheight.%d %.8f other.%d\n",basesp,str,dstr(pax->fiatoshis),pax->height,dstr(pax->puposhis),pax->otherheight); pax2->marked = pax->height; pax->marked = pax->height; } @@ -337,20 +337,20 @@ uint64_t komodo_paxtotal() else if ( pax->type == 'W' ) { //bitcoin_address(coinaddr,addrtype,rmd160,20); - if ( (checktoshis= komodo_paxprice(&seed,pax->height,pax->source,(char *)"HUSH3",(uint64_t)pax->fiatoshis)) != 0 ) + if ( (checktoshis= hush_paxprice(&seed,pax->height,pax->source,(char *)"HUSH3",(uint64_t)pax->fiatoshis)) != 0 ) { - if ( komodo_paxcmp(pax->source,pax->height,pax->komodoshis,checktoshis,seed) != 0 ) + if ( hush_paxcmp(pax->source,pax->height,pax->puposhis,checktoshis,seed) != 0 ) { pax->marked = pax->height; - //printf("WITHDRAW.%s mark <- %d %.8f != %.8f\n",pax->source,pax->height,dstr(checktoshis),dstr(pax->komodoshis)); + //printf("WITHDRAW.%s mark <- %d %.8f != %.8f\n",pax->source,pax->height,dstr(checktoshis),dstr(pax->puposhis)); } else if ( pax->validated == 0 ) { - pax->validated = pax->komodoshis = checktoshis; + pax->validated = pax->puposhis = checktoshis; //int32_t j; for (j=0; j<32; j++) // printf("%02x",((uint8_t *)&pax->txid)[j]); //if ( strcmp(str,SMART_CHAIN_SYMBOL) == 0 ) - // printf(" v%d %p got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->vout,pax,pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->komodoshis),dstr(checktoshis)); + // printf(" v%d %p got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->vout,pax,pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->puposhis),dstr(checktoshis)); } } } @@ -362,7 +362,7 @@ uint64_t komodo_paxtotal() { pax->ready = 0; if ( 0 && pax->type == 'A' ) - printf("%p pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d\n",pax,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0); + printf("%p pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d\n",pax,pax->symbol,pax->source,pax->marked,dstr(pax->puposhis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0); if ( pax->marked != 0 ) continue; if ( strcmp(symbol,pax->symbol) == 0 || pax->type == 'A' ) @@ -381,28 +381,28 @@ uint64_t komodo_paxtotal() { if ( pax->validated != 0 ) { - total += pax->komodoshis; + total += pax->puposhis; pax->ready = 1; } else { seed = 0; - checktoshis = komodo_paxprice(&seed,pax->height,pax->source,(char *)"HUSH3",(uint64_t)pax->fiatoshis); - //printf("paxtotal PAX_fiatdest ht.%d price %s %.8f -> HUSH %.8f vs %.8f\n",pax->height,pax->symbol,(double)pax->fiatoshis/COIN,(double)pax->komodoshis/COIN,(double)checktoshis/COIN); - //printf(" v%d %.8f k.%d ht.%d\n",pax->vout,dstr(pax->komodoshis),pax->height,pax->otherheight); + checktoshis = hush_paxprice(&seed,pax->height,pax->source,(char *)"HUSH3",(uint64_t)pax->fiatoshis); + //printf("paxtotal PAX_fiatdest ht.%d price %s %.8f -> HUSH %.8f vs %.8f\n",pax->height,pax->symbol,(double)pax->fiatoshis/COIN,(double)pax->puposhis/COIN,(double)checktoshis/COIN); + //printf(" v%d %.8f k.%d ht.%d\n",pax->vout,dstr(pax->puposhis),pax->height,pax->otherheight); if ( seed != 0 && checktoshis != 0 ) { - if ( checktoshis == pax->komodoshis ) + if ( checktoshis == pax->puposhis ) { - total += pax->komodoshis; - pax->validated = pax->komodoshis; + total += pax->puposhis; + pax->validated = pax->puposhis; pax->ready = 1; } else pax->marked = pax->height; } } } if ( 0 && pax->ready != 0 ) - printf("%p (%c) pax.%s marked.%d %.8f -> %.8f validated.%d approved.%d ready.%d ht.%d\n",pax,pax->type,pax->symbol,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0,pax->ready,pax->height); + printf("%p (%c) pax.%s marked.%d %.8f -> %.8f validated.%d approved.%d ready.%d ht.%d\n",pax,pax->type,pax->symbol,pax->marked,dstr(pax->puposhis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0,pax->ready,pax->height); } } } @@ -415,8 +415,8 @@ static int _paxorder(const void *a,const void *b) #define pax_a (*(struct pax_transaction **)a) #define pax_b (*(struct pax_transaction **)b) uint64_t aval,bval; - aval = pax_a->fiatoshis + pax_a->komodoshis + pax_a->height; - bval = pax_b->fiatoshis + pax_b->komodoshis + pax_b->height; + aval = pax_a->fiatoshis + pax_a->puposhis + pax_a->height; + bval = pax_b->fiatoshis + pax_b->puposhis + pax_b->height; if ( bval > aval ) return(-1); else if ( bval < aval ) @@ -426,7 +426,7 @@ static int _paxorder(const void *a,const void *b) #undef pax_b } -int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic order +int32_t hush_pending_withdraws(char *opretstr) // todo: enforce deterministic order { struct pax_transaction *pax,*pax2,*tmp,*paxes[64]; uint8_t opretbuf[16384*4]; int32_t i,n,ht,len=0; uint64_t total = 0; if ( HUSH_PAX == 0 || HUSH_PASSPORT_INITDONE == 0 ) @@ -438,12 +438,12 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic { if ( pax->type == 'W' ) { - if ( (pax2= komodo_paxfind(pax->txid,pax->vout,'A')) != 0 ) + if ( (pax2= hush_paxfind(pax->txid,pax->vout,'A')) != 0 ) { if ( pax2->approved != 0 ) pax->approved = pax2->approved; } - else if ( (pax2= komodo_paxfind(pax->txid,pax->vout,'X')) != 0 ) + else if ( (pax2= hush_paxfind(pax->txid,pax->vout,'X')) != 0 ) pax->approved = pax->height; //printf("pending_withdraw: pax %s marked.%u approved.%u validated.%llu\n",pax->symbol,pax->marked,pax->approved,(long long)pax->validated); if ( pax->marked == 0 && pax->approved == 0 && pax->validated != 0 ) @@ -453,7 +453,7 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic paxes[n++] = pax; //int32_t j; for (j=0; j<32; j++) // printf("%02x",((uint8_t *)&pax->txid)[j]); - //printf(" %s.(kmdht.%d ht.%d marked.%u approved.%d validated %.8f) %.8f\n",pax->source,pax->height,pax->otherheight,pax->marked,pax->approved,dstr(pax->validated),dstr(pax->komodoshis)); + //printf(" %s.(kmdht.%d ht.%d marked.%u approved.%d validated %.8f) %.8f\n",pax->source,pax->height,pax->otherheight,pax->marked,pax->approved,dstr(pax->validated),dstr(pax->puposhis)); } } } @@ -466,16 +466,16 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic for (i=0; i>3)*7 ) - len += komodo_rwapproval(1,&opretbuf[len],paxes[i]); + len += hush_rwapproval(1,&opretbuf[len],paxes[i]); } if ( len > 0 ) init_hexbytes_noT(opretstr,opretbuf,len); } - //fprintf(stderr,"komodo_pending_withdraws len.%d PAXTOTAL %.8f\n",len,dstr(komodo_paxtotal())); + //fprintf(stderr,"hush_pending_withdraws len.%d PAXTOTAL %.8f\n",len,dstr(hush_paxtotal())); return(len); } -int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t tokomodo) +int32_t hush_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t tokomodo) { struct pax_transaction *pax,*tmp; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; uint8_t *script,opcode,opret[16384*4],data[16384*4]; int32_t i,baseid,ht,len=0,opretlen=0,numvouts=1; struct hush_state *sp; uint64_t available,deposited,issued,withdrawn,approved,redeemed,mask,sum = 0; if ( HUSH_PASSPORT_INITDONE == 0 )//HUSH_PAX == 0 || @@ -505,7 +505,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to else { opcode = 'X'; - if ( 1 || komodo_paxtotal() == 0 ) + if ( 1 || hush_paxtotal() == 0 ) return(0); } HASH_ITER(hh,PAX,pax,tmp) @@ -517,18 +517,18 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to if ( pax->height > 236000 ) { if ( kmdsp != 0 && kmdsp->NOTARIZED_HEIGHT >= pax->height ) - pax->validated = pax->komodoshis; + pax->validated = pax->puposhis; else if ( kmdsp->CURRENT_HEIGHT > pax->height+30 ) pax->validated = pax->ready = 0; } else { if ( kmdsp != 0 && (kmdsp->NOTARIZED_HEIGHT >= pax->height || kmdsp->CURRENT_HEIGHT > pax->height+30) ) // assumes same chain as notarize - pax->validated = pax->komodoshis; + pax->validated = pax->puposhis; else pax->validated = pax->ready = 0; } #else - pax->validated = pax->komodoshis; + pax->validated = pax->puposhis; #endif } if ( SMART_CHAIN_SYMBOL[0] != 0 && (pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) != 0 || available < pax->fiatoshis) ) @@ -537,7 +537,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to // printf("miner.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",SMART_CHAIN_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed)); continue; } - /*printf("pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d\n",pax->symbol,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0); + /*printf("pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d\n",pax->symbol,pax->marked,dstr(pax->puposhis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0); if ( pax->marked != 0 || (pax->type != 'D' && pax->type != 'A') || pax->ready == 0 ) { printf("reject 2\n"); @@ -564,9 +564,9 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to } else continue; } - //printf("redeem.%d? (%c) %p pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d approved.%d\n",tokomodo,pax->type,pax,pax->symbol,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0,pax->approved!=0); + //printf("redeem.%d? (%c) %p pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d approved.%d\n",tokomodo,pax->type,pax,pax->symbol,pax->marked,dstr(pax->puposhis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0,pax->approved!=0); if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 ) - printf("pax.%s marked.%d %.8f -> %.8f\n",SMART_CHAIN_SYMBOL,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis)); + printf("pax.%s marked.%d %.8f -> %.8f\n",SMART_CHAIN_SYMBOL,pax->marked,dstr(pax->puposhis),dstr(pax->fiatoshis)); if ( opcode == 'I' ) { sum += pax->fiatoshis; @@ -574,7 +574,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to break; } txNew->vout.resize(numvouts+1); - txNew->vout[numvouts].nValue = (opcode == 'I') ? pax->fiatoshis : pax->komodoshis; + txNew->vout[numvouts].nValue = (opcode == 'I') ? pax->fiatoshis : pax->puposhis; txNew->vout[numvouts].scriptPubKey.resize(25); script = (uint8_t *)&txNew->vout[numvouts].scriptPubKey[0]; *script++ = 0x76; @@ -593,8 +593,8 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to } else { - len += komodo_rwapproval(1,&data[len],pax); - PENDING_HUSH_TX += pax->komodoshis; + len += hush_rwapproval(1,&data[len],pax); + PENDING_HUSH_TX += pax->puposhis; printf(" len.%d vout.%u DEPOSIT %.8f <- pax.%s pending ht %d %d %.8f | ",len,pax->vout,(double)txNew->vout[numvouts].nValue/COIN,symbol,pax->height,pax->otherheight,dstr(PENDING_HUSH_TX)); } if ( numvouts++ >= 64 || sum > COIN ) @@ -665,12 +665,12 @@ int32_t hush_checkvout(int32_t vout,int32_t k,int32_t indallvouts) else return(vout == 0); } -int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max) +int32_t hush_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max) { int32_t i; if ( sizeof(banned_txids)/sizeof(*banned_txids) > max ) { - fprintf(stderr,"komodo_bannedset: buffer too small %d vs %d\n",(int32_t)(sizeof(banned_txids)/sizeof(*banned_txids)),max); + fprintf(stderr,"hush_bannedset: buffer too small %d vs %d\n",(int32_t)(sizeof(banned_txids)/sizeof(*banned_txids)),max); StartShutdown(); } for (i=0; i 195000 || kmdheight <= height) ) + if ( strcmp(base,SMART_CHAIN_SYMBOL) == 0 && (hushheight > 195000 || hushheight <= height) ) { didstats = 0; - if ( komodo_paxcmp(base,kmdheight,value,checktoshis,kmdheight < 225000 ? seed : 0) == 0 ) + if ( hush_paxcmp(base,hushheight,value,checktoshis,hushheight < 225000 ? seed : 0) == 0 ) { - if ( (pax= komodo_paxfind(txid,vout,'D')) == 0 ) + if ( (pax= hush_paxfind(txid,vout,'D')) == 0 ) { if ( (basesp= hush_stateptrget(base)) != 0 ) { basesp->deposited += fiatoshis; didstats = 1; if ( 0 && strcmp(base,SMART_CHAIN_SYMBOL) == 0 ) - printf("########### %p deposited %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value)); + printf("########### %p deposited %s += %.8f hushheight.%d %.8f\n",basesp,base,dstr(fiatoshis),hushheight,dstr(value)); } else printf("cant get stateptr.(%s)\n",base); - komodo_gateway_deposit(coinaddr,value,base,fiatoshis,rmd160,txid,vout,'D',kmdheight,height,(char *)"HUSH3",0); + hush_gateway_deposit(coinaddr,value,base,fiatoshis,rmd160,txid,vout,'D',hushheight,height,(char *)"HUSH3",0); } - if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 ) + if ( (pax= hush_paxfind(txid,vout,'D')) != 0 ) { - pax->height = kmdheight; + pax->height = hushheight; pax->validated = value; - pax->komodoshis = value; + pax->puposhis = value; pax->fiatoshis = fiatoshis; if ( didstats == 0 && pax->didstats == 0 ) { @@ -904,15 +904,15 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->deposited += fiatoshis; didstats = 1; if ( 0 && strcmp(base,SMART_CHAIN_SYMBOL) == 0 ) - printf("########### %p depositedB %s += %.8f/%.8f kmdheight.%d/%d %.8f/%.8f\n",basesp,base,dstr(fiatoshis),dstr(pax->fiatoshis),kmdheight,pax->height,dstr(value),dstr(pax->komodoshis)); + printf("########### %p depositedB %s += %.8f/%.8f hushheight.%d/%d %.8f/%.8f\n",basesp,base,dstr(fiatoshis),dstr(pax->fiatoshis),hushheight,pax->height,dstr(value),dstr(pax->puposhis)); } } // if ( didstats != 0 ) pax->didstats = 1; - if ( (pax2= komodo_paxfind(txid,vout,'I')) != 0 ) + if ( (pax2= hush_paxfind(txid,vout,'I')) != 0 ) { pax2->fiatoshis = pax->fiatoshis; - pax2->komodoshis = pax->komodoshis; + pax2->puposhis = pax->puposhis; pax->marked = pax2->marked = pax->height; pax2->height = pax->height = height; if ( pax2->didstats == 0 ) @@ -922,7 +922,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->issued += pax2->fiatoshis; pax2->didstats = 1; if ( 0 && strcmp(base,"USD") == 0 ) - printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d [%d]\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight,height); + printf("########### %p issueda %s += %.8f hushheight.%d %.8f other.%d [%d]\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->puposhis),pax2->otherheight,height); } } } @@ -930,12 +930,12 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } else { - if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 ) + if ( (pax= hush_paxfind(txid,vout,'D')) != 0 ) pax->marked = checktoshis; - if ( kmdheight > 238000 && (kmdheight > 214700 || strcmp(base,SMART_CHAIN_SYMBOL) == 0) ) //seed != 0 && - printf("pax %s deposit %.8f rejected kmdheight.%d %.8f HUSH3 check %.8f seed.%llu\n",base,dstr(fiatoshis),kmdheight,dstr(value),dstr(checktoshis),(long long)seed); + if ( hushheight > 238000 && (hushheight > 214700 || strcmp(base,SMART_CHAIN_SYMBOL) == 0) ) //seed != 0 && + printf("pax %s deposit %.8f rejected hushheight.%d %.8f HUSH3 check %.8f seed.%llu\n",base,dstr(fiatoshis),hushheight,dstr(value),dstr(checktoshis),(long long)seed); } - } //else printf("[%s] %s paxdeposit height.%d vs kmdheight.%d\n",SMART_CHAIN_SYMBOL,base,height,kmdheight); + } //else printf("[%s] %s paxdeposit height.%d vs hushheight.%d\n",SMART_CHAIN_SYMBOL,base,height,hushheight); } //else printf("unsupported size.%d for opreturn D\n",opretlen); } else if ( opretbuf[0] == 'I' ) @@ -943,7 +943,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 tokomodo = 0; if ( strncmp((char *)"HUSH3",(char *)&opretbuf[opretlen-4],3) != 0 && strncmp(SMART_CHAIN_SYMBOL,(char *)&opretbuf[opretlen-4],3) == 0 ) { - if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,0)) > 0 ) + if ( (n= hush_issued_opreturn(base,txids,vouts,values,srcvalues,hushheights,otherheights,baseids,rmd160s,opretbuf,opretlen,0)) > 0 ) { for (i=0; itype = opretbuf[0]; strcpy(pax->source,(char *)&opretbuf[opretlen-4]); - if ( (pax2= komodo_paxfind(txids[i],vouts[i],'D')) != 0 && pax2->fiatoshis != 0 && pax2->komodoshis != 0 ) + if ( (pax2= hush_paxfind(txids[i],vouts[i],'D')) != 0 && pax2->fiatoshis != 0 && pax2->puposhis != 0 ) { // realtime path? pax->fiatoshis = pax2->fiatoshis; - pax->komodoshis = pax2->komodoshis; + pax->puposhis = pax2->puposhis; pax->marked = pax2->marked = pax2->height; if ( pax->didstats == 0 ) { @@ -976,15 +976,15 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 pax->height = pax2->height; pax->otherheight = height; if ( 1 && strcmp(CURRENCIES[baseids[i]],"USD") == 0 ) - printf("########### %p issuedb %s += %.8f kmdheight.%d %.8f other.%d [%d]\n",basesp,CURRENCIES[baseids[i]],dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight,height); + printf("########### %p issuedb %s += %.8f hushheight.%d %.8f other.%d [%d]\n",basesp,CURRENCIES[baseids[i]],dstr(pax->fiatoshis),pax->height,dstr(pax->puposhis),pax->otherheight,height); } } } } - if ( (pax= komodo_paxmark(height,txids[i],vouts[i],'I',height)) != 0 ) - komodo_paxdelete(pax); - if ( (pax= komodo_paxmark(height,txids[i],vouts[i],'D',height)) != 0 ) - komodo_paxdelete(pax); + if ( (pax= hush_paxmark(height,txids[i],vouts[i],'I',height)) != 0 ) + hush_paxdelete(pax); + if ( (pax= hush_paxmark(height,txids[i],vouts[i],'D',height)) != 0 ) + hush_paxdelete(pax); } } //else printf("opreturn none issued?\n"); } @@ -999,17 +999,17 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 return(typestr); } tokomodo = 1; - dragon_rwnum(0,&opretbuf[34],sizeof(kmdheight),&kmdheight); + dragon_rwnum(0,&opretbuf[34],sizeof(hushheight),&hushheight); memset(base,0,sizeof(base)); - PAX_pubkey(0,&opretbuf[1],&addrtype,rmd160,base,&shortflag,&komodoshis); + PAX_pubkey(0,&opretbuf[1],&addrtype,rmd160,base,&shortflag,&puposhis); bitcoin_address(coinaddr,addrtype,rmd160,20); - checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,value); + checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,hushheight,base,value); typestr = "withdraw"; - //printf(" [%s] WITHDRAW %s.height.%d vs height.%d check %.8f/%.8f vs %.8f tokomodo.%d %d seed.%llx -> (%s) len.%d\n",SMART_CHAIN_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(komodoshis),dstr(value),hush_is_issuer(),strncmp(SMART_CHAIN_SYMBOL,base,strlen(base)) == 0,(long long)seed,coinaddr,opretlen); + //printf(" [%s] WITHDRAW %s.height.%d vs height.%d check %.8f/%.8f vs %.8f tokomodo.%d %d seed.%llx -> (%s) len.%d\n",SMART_CHAIN_SYMBOL,base,hushheight,height,dstr(checktoshis),dstr(puposhis),dstr(value),hush_is_issuer(),strncmp(SMART_CHAIN_SYMBOL,base,strlen(base)) == 0,(long long)seed,coinaddr,opretlen); didstats = 0; - //if ( komodo_paxcmp(base,kmdheight,komodoshis,checktoshis,seed) == 0 ) + //if ( hush_paxcmp(base,hushheight,puposhis,checktoshis,seed) == 0 ) { - if ( value != 0 && ((pax= komodo_paxfind(txid,vout,'W')) == 0 || pax->didstats == 0) ) + if ( value != 0 && ((pax= hush_paxfind(txid,vout,'W')) == 0 || pax->didstats == 0) ) { if ( (basesp= hush_stateptrget(base)) != 0 ) { @@ -1019,19 +1019,19 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 printf("########### %p withdrawn %s += %.8f check %.8f\n",basesp,base,dstr(value),dstr(checktoshis)); } if ( 0 && strcmp(base,"RUB") == 0 && (pax == 0 || pax->approved == 0) ) - printf("notarize %s %.8f -> %.8f kmd.%d other.%d\n",SMART_CHAIN_SYMBOL,dstr(value),dstr(komodoshis),kmdheight,height); + printf("notarize %s %.8f -> %.8f kmd.%d other.%d\n",SMART_CHAIN_SYMBOL,dstr(value),dstr(puposhis),hushheight,height); } - komodo_gateway_deposit(coinaddr,0,(char *)"HUSH3",value,rmd160,txid,vout,'W',kmdheight,height,source,0); - if ( (pax= komodo_paxfind(txid,vout,'W')) != 0 ) + hush_gateway_deposit(coinaddr,0,(char *)"HUSH3",value,rmd160,txid,vout,'W',hushheight,height,source,0); + if ( (pax= hush_paxfind(txid,vout,'W')) != 0 ) { pax->type = opretbuf[0]; strcpy(pax->source,base); strcpy(pax->symbol,"HUSH3"); - pax->height = kmdheight; + pax->height = hushheight; pax->otherheight = height; - pax->komodoshis = komodoshis; + pax->puposhis = puposhis; } - } // else printf("withdraw %s paxcmp ht.%d %d error value %.8f -> %.8f vs %.8f\n",base,kmdheight,height,dstr(value),dstr(komodoshis),dstr(checktoshis)); + } // else printf("withdraw %s paxcmp ht.%d %d error value %.8f -> %.8f vs %.8f\n",base,hushheight,height,dstr(value),dstr(puposhis),dstr(checktoshis)); // need to allocate pax } else if ( height < 236000 && tokomodo != 0 && opretbuf[0] == 'A' && SMART_CHAIN_SYMBOL[0] == 0 ) @@ -1041,22 +1041,22 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { for (i=0; i 0 ) + if ( (n= hush_issued_opreturn(base,txids,vouts,values,srcvalues,hushheights,otherheights,baseids,rmd160s,opretbuf,opretlen,1)) > 0 ) { for (i=0; isymbol); printf("override neg1 with (%s)\n",pax->symbol); @@ -1066,26 +1066,26 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } didstats = 0; seed = 0; - checktoshis = komodo_paxprice(&seed,kmdheights[i],CURRENCIES[baseids[i]],(char *)"HUSH3",(uint64_t)values[i]); - //printf("PAX_fiatdest ht.%d price %s %.8f -> HUSH3 %.8f vs %.8f\n",kmdheights[i],CURRENCIES[baseids[i]],(double)values[i]/COIN,(double)srcvalues[i]/COIN,(double)checktoshis/COIN); + checktoshis = hush_paxprice(&seed,hushheights[i],CURRENCIES[baseids[i]],(char *)"HUSH3",(uint64_t)values[i]); + //printf("PAX_fiatdest ht.%d price %s %.8f -> HUSH3 %.8f vs %.8f\n",hushheights[i],CURRENCIES[baseids[i]],(double)values[i]/COIN,(double)srcvalues[i]/COIN,(double)checktoshis/COIN); if ( srcvalues[i] == checktoshis ) { - if ( (pax= komodo_paxfind(txids[i],vouts[i],'A')) == 0 ) + if ( (pax= hush_paxfind(txids[i],vouts[i],'A')) == 0 ) { bitcoin_address(coinaddr,60,&rmd160s[i*20],20); - komodo_gateway_deposit(coinaddr,srcvalues[i],CURRENCIES[baseids[i]],values[i],&rmd160s[i*20],txids[i],vouts[i],'A',kmdheights[i],otherheights[i],CURRENCIES[baseids[i]],kmdheights[i]); - if ( (pax= komodo_paxfind(txids[i],vouts[i],'A')) == 0 ) + hush_gateway_deposit(coinaddr,srcvalues[i],CURRENCIES[baseids[i]],values[i],&rmd160s[i*20],txids[i],vouts[i],'A',hushheights[i],otherheights[i],CURRENCIES[baseids[i]],hushheights[i]); + if ( (pax= hush_paxfind(txids[i],vouts[i],'A')) == 0 ) printf("unexpected null pax for approve\n"); else pax->validated = checktoshis; - if ( (pax2= komodo_paxfind(txids[i],vouts[i],'W')) != 0 ) - pax2->approved = kmdheights[i]; - komodo_paxmark(height,txids[i],vouts[i],'W',height); - //komodo_paxmark(height,txids[i],vouts[i],'A',height); + if ( (pax2= hush_paxfind(txids[i],vouts[i],'W')) != 0 ) + pax2->approved = hushheights[i]; + hush_paxmark(height,txids[i],vouts[i],'W',height); + //hush_paxmark(height,txids[i],vouts[i],'A',height); if ( values[i] != 0 && (basesp= hush_stateptrget(CURRENCIES[baseids[i]])) != 0 ) { basesp->approved += values[i]; didstats = 1; - //printf("pax.%p ########### %p approved %s += %.8f -> %.8f/%.8f kht.%d %d\n",pax,basesp,CURRENCIES[baseids[i]],dstr(values[i]),dstr(srcvalues[i]),dstr(checktoshis),kmdheights[i],otherheights[i]); + //printf("pax.%p ########### %p approved %s += %.8f -> %.8f/%.8f kht.%d %d\n",pax,basesp,CURRENCIES[baseids[i]],dstr(values[i]),dstr(srcvalues[i]),dstr(checktoshis),hushheights[i],otherheights[i]); } //printf(" i.%d (%s) <- %.8f ADDFLAG APPROVED\n",i,coinaddr,dstr(values[i])); } @@ -1095,39 +1095,39 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { basesp->approved += values[i]; didstats = 1; - //printf("pax.%p ########### %p approved %s += %.8f -> %.8f/%.8f kht.%d %d\n",pax,basesp,CURRENCIES[baseids[i]],dstr(values[i]),dstr(srcvalues[i]),dstr(checktoshis),kmdheights[i],otherheights[i]); + //printf("pax.%p ########### %p approved %s += %.8f -> %.8f/%.8f kht.%d %d\n",pax,basesp,CURRENCIES[baseids[i]],dstr(values[i]),dstr(srcvalues[i]),dstr(checktoshis),hushheights[i],otherheights[i]); } } //else printf(" i.%d of n.%d pax.%p baseids[] %d\n",i,n,pax,baseids[i]); - if ( (pax= komodo_paxfind(txids[i],vouts[i],'A')) != 0 ) + if ( (pax= hush_paxfind(txids[i],vouts[i],'A')) != 0 ) { pax->type = opretbuf[0]; - pax->approved = kmdheights[i]; + pax->approved = hushheights[i]; pax->validated = checktoshis; if ( didstats != 0 ) pax->didstats = 1; //if ( strcmp(CURRENCIES[baseids[i]],SMART_CHAIN_SYMBOL) == 0 ) - //printf(" i.%d approved.%d <<<<<<<<<<<<< APPROVED %p\n",i,kmdheights[i],pax); + //printf(" i.%d approved.%d <<<<<<<<<<<<< APPROVED %p\n",i,hushheights[i],pax); } } } } //else printf("n.%d from opreturns\n",n); - //printf("extra.[%d] after %.8f\n",n,dstr(komodo_paxtotal())); + //printf("extra.[%d] after %.8f\n",n,dstr(hush_paxtotal())); } else if ( height < 236000 && opretbuf[0] == 'X' && SMART_CHAIN_SYMBOL[0] == 0 ) { tokomodo = 1; - if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,1)) > 0 ) + if ( (n= hush_issued_opreturn(base,txids,vouts,values,srcvalues,hushheights,otherheights,baseids,rmd160s,opretbuf,opretlen,1)) > 0 ) { for (i=0; itype = opretbuf[0]; if ( height < 121842 ) // fields got switched around due to legacy issues and approves @@ -1138,17 +1138,17 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->redeemed += value; pax->didstats = 1; if ( strcmp(CURRENCIES[baseids[i]],SMART_CHAIN_SYMBOL) == 0 ) - printf("ht.%d %.8f ########### %p redeemed %s += %.8f %.8f kht.%d ht.%d\n",height,dstr(value),basesp,CURRENCIES[baseids[i]],dstr(value),dstr(srcvalues[i]),kmdheights[i],otherheights[i]); + printf("ht.%d %.8f ########### %p redeemed %s += %.8f %.8f kht.%d ht.%d\n",height,dstr(value),basesp,CURRENCIES[baseids[i]],dstr(value),dstr(srcvalues[i]),hushheights[i],otherheights[i]); } } - if ( (pax= komodo_paxmark(height,txids[i],vouts[i],'W',height)) != 0 ) - komodo_paxdelete(pax); - if ( (pax= komodo_paxmark(height,txids[i],vouts[i],'A',height)) != 0 ) - komodo_paxdelete(pax); - if ( (pax= komodo_paxmark(height,txids[i],vouts[i],'X',height)) != 0 ) - komodo_paxdelete(pax); + if ( (pax= hush_paxmark(height,txids[i],vouts[i],'W',height)) != 0 ) + hush_paxdelete(pax); + if ( (pax= hush_paxmark(height,txids[i],vouts[i],'A',height)) != 0 ) + hush_paxdelete(pax); + if ( (pax= hush_paxmark(height,txids[i],vouts[i],'X',height)) != 0 ) + hush_paxdelete(pax); } - } //else printf("komodo_issued_opreturn returned %d\n",n); + } //else printf("hush_issued_opreturn returned %d\n",n); } return(typestr); } @@ -1339,7 +1339,7 @@ long hush_stateind_validate(struct hush_state *sp,char *indfname,uint8_t *fileda return(-1); } -long komodo_indfile_update(FILE *indfp,uint32_t *prevpos100p,long lastfpos,long newfpos,uint8_t func,uint32_t *indcounterp) +long hush_indfile_update(FILE *indfp,uint32_t *prevpos100p,long lastfpos,long newfpos,uint8_t func,uint32_t *indcounterp) { uint32_t tmp; if ( indfp != 0 ) @@ -1375,7 +1375,7 @@ int32_t hush_faststateinit(struct hush_state *sp,char *fname,char *symbol,char * fprintf(stderr,"processing %s %ldKB, validated.%ld\n",fname,datalen/1024,validated); while ( (func= hush_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest)) >= 0 ) { - lastfpos = komodo_indfile_update(indfp,&prevpos100,lastfpos,fpos,func,&indcounter); + lastfpos = hush_indfile_update(indfp,&prevpos100,lastfpos,fpos,func,&indcounter); } if ( indfp != 0 ) { @@ -1400,7 +1400,7 @@ int32_t hush_faststateinit(struct hush_state *sp,char *fname,char *symbol,char * { while ( (func= hush_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest)) >= 0 ) { - lastfpos = komodo_indfile_update(indfp,&prevpos100,lastfpos,fpos,func,&indcounter); + lastfpos = hush_indfile_update(indfp,&prevpos100,lastfpos,fpos,func,&indcounter); if ( lastfpos != fpos ) fprintf(stderr,"unexpected lastfpos.%ld != %ld\n",lastfpos,fpos); } @@ -1555,7 +1555,7 @@ void hush_passport_iteration() if ( sp != 0 && isrealtime == 0 ) refsp->RTbufs[0][2] = 0; } - //komodo_paxtotal(); // calls hush_isrealtime(), which calls hush_longestchain() + //hush_paxtotal(); // calls hush_isrealtime(), which calls hush_longestchain() refsp->RTmask |= RTmask; if ( expired == 0 && HUSH_PASSPORT_INITDONE == 0 ) { @@ -1574,13 +1574,13 @@ extern std::vector Mineropret; // opreturn data set by the data gatheri #define issue_curl(cmdstr) bitcoind_RPC(0,(char *)"CBCOINBASE",cmdstr,0,0,0) -const char *Cryptos[] = { "HUSH", "ETH" }; // must be on binance (for now) +const char *Cryptos[] = { "HUSH", "ETH" }; // "LTC", "BCHABC", "XMR", "IOTA", "ZEC", "WAVES", "LSK", "DCR", "RVN", "DASH", "XEM", "BTS", "ICX", "HOT", "STEEM", "ENJ", "STRAT" const char *Forex[] = { "BGN","NZD","ILS","RUB","CAD","PHP","CHF","AUD","JPY","TRY","HKD","MYR","HRK","CZK","IDR","DKK","NOK","HUF","GBP","MXN","THB","ISK","ZAR","BRL","SGD","PLN","INR","KRW","RON","CNY","SEK","EUR" }; // must be in ECB list -struct komodo_extremeprice +struct hush_extremeprice { uint256 blockhash; uint32_t pricebits,timestamp; @@ -1588,7 +1588,7 @@ struct komodo_extremeprice int16_t dir,ind; } ExtremePrice; -struct komodo_priceinfo +struct hush_priceinfo { FILE *fp; char symbol[64]; @@ -1598,7 +1598,7 @@ uint32_t PriceCache[HUSH_LOCALPRICE_CACHESIZE][HUSH_MAXPRICES];//4+sizeof(Crypto int64_t PriceMult[HUSH_MAXPRICES]; int32_t hush_cbopretsize(uint64_t flags); -void komodo_PriceCache_shift() +void hush_PriceCache_shift() { int32_t i; for (i=HUSH_LOCALPRICE_CACHESIZE-1; i>0; i--) @@ -1640,9 +1640,9 @@ int32_t hush_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeigh } /* - komodo_pricenew() is passed in a reference price, the change tolerance and the proposed price. it needs to return a clipped price if it is too big and also set a flag if it is at or above the limit + hush_pricenew() is passed in a reference price, the change tolerance and the proposed price. it needs to return a clipped price if it is too big and also set a flag if it is at or above the limit */ -uint32_t komodo_pricenew(char *maxflagp,uint32_t price,uint32_t refprice,int64_t tolerance) +uint32_t hush_pricenew(char *maxflagp,uint32_t price,uint32_t refprice,int64_t tolerance) { uint64_t highprice,lowprice; if ( refprice < 2 ) @@ -1676,13 +1676,13 @@ uint32_t komodo_pricenew(char *maxflagp,uint32_t price,uint32_t refprice,int64_t return(0); } -// komodo_pricecmp() returns -1 if any of the prices are beyond the tolerance -int32_t komodo_pricecmp(int32_t nHeight,int32_t n,char *maxflags,uint32_t *pricebitsA,uint32_t *pricebitsB,int64_t tolerance) +// hush_pricecmp() returns -1 if any of the prices are beyond the tolerance +int32_t hush_pricecmp(int32_t nHeight,int32_t n,char *maxflags,uint32_t *pricebitsA,uint32_t *pricebitsB,int64_t tolerance) { int32_t i; uint32_t newprice; for (i=1; i newprice.%u out of tolerance maxflag.%d\n",nHeight,i,n,pricebitsB[i],pricebitsA[i],newprice,maxflags[i]); return(-1); @@ -1691,14 +1691,14 @@ int32_t komodo_pricecmp(int32_t nHeight,int32_t n,char *maxflags,uint32_t *price return(0); } -// komodo_priceclamp() clamps any price that is beyond tolerance -int32_t komodo_priceclamp(int32_t n,uint32_t *pricebits,uint32_t *refprices,int64_t tolerance) +// hush_priceclamp() clamps any price that is beyond tolerance +int32_t hush_priceclamp(int32_t n,uint32_t *pricebits,uint32_t *refprices,int64_t tolerance) { int32_t i; uint32_t newprice; char maxflags[HUSH_MAXPRICES]; memset(maxflags,0,sizeof(maxflags)); for (i=1; i %u\n",i,n,refprices[i],pricebits[i],newprice); pricebits[i] = newprice; @@ -1707,8 +1707,8 @@ int32_t komodo_priceclamp(int32_t n,uint32_t *pricebits,uint32_t *refprices,int6 return(0); } -// komodo_mineropret() returns a valid pricedata to add to the coinbase opreturn for nHeight -CScript komodo_mineropret(int32_t nHeight) +// hush_mineropret() returns a valid pricedata to add to the coinbase opreturn for nHeight +CScript hush_mineropret(int32_t nHeight) { CScript opret; char maxflags[HUSH_MAXPRICES]; uint32_t pricebits[HUSH_MAXPRICES],prevbits[HUSH_MAXPRICES]; int32_t maxflag,i,n,numzero=0; if ( Mineropret.size() >= PRICES_SIZEBIT0 ) @@ -1726,7 +1726,7 @@ CScript komodo_mineropret(int32_t nHeight) } if ( numzero != 0 ) { - fprintf(stderr," komodo_mineropret numzero.%d vs n.%d\n",numzero,n); + fprintf(stderr," hush_mineropret numzero.%d vs n.%d\n",numzero,n); hush_cbopretupdate(1); sleep(61); } @@ -1735,10 +1735,10 @@ CScript komodo_mineropret(int32_t nHeight) { memcpy(pricebits,Mineropret.data(),Mineropret.size()); memset(maxflags,0,sizeof(maxflags)); - if ( komodo_pricecmp(0,n,maxflags,pricebits,prevbits,PRICES_ERRORRATE) < 0 ) + if ( hush_pricecmp(0,n,maxflags,pricebits,prevbits,PRICES_ERRORRATE) < 0 ) { // if the new prices are outside tolerance, update Mineropret with clamped prices - komodo_priceclamp(n,pricebits,prevbits,PRICES_ERRORRATE); + hush_priceclamp(n,pricebits,prevbits,PRICES_ERRORRATE); //fprintf(stderr,"update Mineropret to clamped prices\n"); memcpy(Mineropret.data(),pricebits,Mineropret.size()); } @@ -1761,7 +1761,7 @@ CScript komodo_mineropret(int32_t nHeight) */ -void komodo_queuelocalprice(int32_t dir,int32_t height,uint32_t timestamp,uint256 blockhash,int32_t ind,uint32_t pricebits) +void hush_queuelocalprice(int32_t dir,int32_t height,uint32_t timestamp,uint256 blockhash,int32_t ind,uint32_t pricebits) { fprintf(stderr,"ExtremePrice dir.%d ht.%d ind.%d cmpbits.%u\n",dir,height,ind,pricebits); ExtremePrice.dir = dir; @@ -1821,7 +1821,7 @@ int32_t hush_opretvalidate(const CBlock *block,CBlockIndex * const previndex,int if ( pricebits[i] == 0 ) pricebits[i] = prevbits[i]; } - if ( komodo_pricecmp(nHeight,n,maxflags,pricebits,prevbits,PRICES_ERRORRATE) < 0 ) + if ( hush_pricecmp(nHeight,n,maxflags,pricebits,prevbits,PRICES_ERRORRATE) < 0 ) { for (i=1; inTime,bhash,i,prevbits[i]); + hush_queuelocalprice(1,nHeight,block->nTime,bhash,i,prevbits[i]); break; } } @@ -1880,7 +1880,7 @@ int32_t hush_opretvalidate(const CBlock *block,CBlockIndex * const previndex,int } if ( j == HUSH_LOCALPRICE_CACHESIZE ) { - komodo_queuelocalprice(-1,nHeight,block->nTime,bhash,i,prevbits[i]); + hush_queuelocalprice(-1,nHeight,block->nTime,bhash,i,prevbits[i]); break; } } @@ -2250,7 +2250,7 @@ void hush_cbopretupdate(int32_t forceflag) if ( (forceflag != 0 || now > lastbtc+120) && get_btcusd(pricebits) == 0 ) { if ( flags == 0 ) - komodo_PriceCache_shift(); + hush_PriceCache_shift(); memcpy(PriceCache[0],pricebits,PRICES_SIZEBIT0); flags |= 1; } @@ -2260,7 +2260,7 @@ void hush_cbopretupdate(int32_t forceflag) { get_dailyfx(forexprices); if ( flags == 0 ) - komodo_PriceCache_shift(); + hush_PriceCache_shift(); flags |= 2; memcpy(&PriceCache[0][size/sizeof(uint32_t)],forexprices,sizeof(forexprices)); } @@ -2272,7 +2272,7 @@ void hush_cbopretupdate(int32_t forceflag) { get_cryptoprices(pricebuf,Cryptos,(int32_t)(sizeof(Cryptos)/sizeof(*Cryptos)),ASSETCHAINS_PRICES); if ( flags == 0 ) - komodo_PriceCache_shift(); + hush_PriceCache_shift(); memcpy(&PriceCache[0][size/sizeof(uint32_t)],pricebuf,(sizeof(Cryptos)/sizeof(*Cryptos)+ASSETCHAINS_PRICES.size()) * sizeof(uint32_t)); flags |= 4; // very rarely we can see flags == 6 case } @@ -2286,7 +2286,7 @@ void hush_cbopretupdate(int32_t forceflag) if ( get_stockprices(now,pricebuf,ASSETCHAINS_STOCKS) == ASSETCHAINS_STOCKS.size() ) { if ( flags == 0 ) - komodo_PriceCache_shift(); + hush_PriceCache_shift(); memcpy(&PriceCache[0][size/sizeof(uint32_t)],pricebuf,ASSETCHAINS_STOCKS.size() * sizeof(uint32_t)); flags |= 8; // very rarely we can see flags == 10 case } @@ -2322,7 +2322,7 @@ void hush_cbopretupdate(int32_t forceflag) pending = 0; } -int64_t komodo_pricemult(int32_t ind) +int64_t hush_pricemult(int32_t ind) { int32_t i,j; if ( (ASSETCHAINS_CBOPRET & 1) != 0 && ind < HUSH_MAXPRICES ) @@ -2352,7 +2352,7 @@ int64_t komodo_pricemult(int32_t ind) return(0); } -char *komodo_pricename(char *name,int32_t ind) +char *hush_pricename(char *name,int32_t ind) { strcpy(name,"error"); if ( (ASSETCHAINS_CBOPRET & 1) != 0 && ind < HUSH_MAXPRICES ) @@ -2416,24 +2416,24 @@ char *komodo_pricename(char *name,int32_t ind) return(0); } // finds index for its symbol name -int32_t komodo_priceind(const char *symbol) +int32_t hush_priceind(const char *symbol) { char name[65]; int32_t i,n = (int32_t)(hush_cbopretsize(ASSETCHAINS_CBOPRET) / sizeof(uint32_t)); for (i=1; i= HUSH_MAXPRICES ) return(-1); - mult = komodo_pricemult(ind); + mult = hush_pricemult(ind); if ( nonzprices != 0 ) memset(nonzprices,0,sizeof(*nonzprices)*PRICES_DAYWINDOW); //for (i=0; i 0 ) + if ( (correlated= hush_pricecorrelated(rngval,ind,&ptr32[offset],-numprices,0,PRICES_SMOOTHWIDTH)) > 0 ) { fseek(PRICES[ind].fp,height * sizeof(int64_t) * PRICES_MAXDATAPOINTS,SEEK_SET); memset(buf,0,sizeof(buf)); @@ -2784,7 +2784,7 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock) fseek(PRICES[ind].fp,(height-PRICES_DAYWINDOW+1) * PRICES_MAXDATAPOINTS * sizeof(int64_t),SEEK_SET); if ( fread(ptr64,sizeof(int64_t),PRICES_DAYWINDOW*PRICES_MAXDATAPOINTS,PRICES[ind].fp) == PRICES_DAYWINDOW*PRICES_MAXDATAPOINTS ) { - if ( (smoothed= komodo_priceave(tmpbuf,&ptr64[(PRICES_DAYWINDOW-1)*PRICES_MAXDATAPOINTS+1],-PRICES_MAXDATAPOINTS)) > 0 ) + if ( (smoothed= hush_priceave(tmpbuf,&ptr64[(PRICES_DAYWINDOW-1)*PRICES_MAXDATAPOINTS+1],-PRICES_MAXDATAPOINTS)) > 0 ) { fseek(PRICES[ind].fp,(height * PRICES_MAXDATAPOINTS + 2) * sizeof(int64_t),SEEK_SET); if ( fwrite(&smoothed,1,sizeof(smoothed),PRICES[ind].fp) != sizeof(smoothed) ) @@ -2793,7 +2793,7 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock) } else fprintf(stderr,"error price_smoothed ht.%d ind.%d\n",height,ind); } else fprintf(stderr,"error fread ptr64 for ht.%d ind.%d\n",height,ind); } - } else fprintf(stderr,"error komodo_pricecorrelated for ht.%d ind.%d\n",height,ind); + } else fprintf(stderr,"error hush_pricecorrelated for ht.%d ind.%d\n",height,ind); } fprintf(stderr,"height.%d\n",height); } else fprintf(stderr,"error reading rawprices for ht.%d\n",height); @@ -2803,7 +2803,7 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock) } else fprintf(stderr,"numprices mismatch, height.%d\n",height); } -int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks) +int32_t hush_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks) { FILE *fp; int32_t retval = PRICES_MAXDATAPOINTS; pthread_mutex_lock(&pricemutex); diff --git a/src/hush_globals.h b/src/hush_globals.h index 605d78021..ebb074d03 100644 --- a/src/hush_globals.h +++ b/src/hush_globals.h @@ -26,11 +26,11 @@ int32_t hush_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *not char *hush_issuemethod(char *userpass,char *method,char *params,uint16_t port); void hush_init(int32_t height); int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); -int32_t hush_isrealtime(int32_t *kmdheightp); -uint64_t komodo_paxtotal(); +int32_t hush_isrealtime(int32_t *hushheightp); +uint64_t hush_paxtotal(); int32_t hush_longestchain(); -uint64_t komodo_maxallowed(int32_t baseid); -int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max); +uint64_t hush_maxallowed(int32_t baseid); +int32_t hush_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max); int32_t hush_checkvout(int32_t vout,int32_t k,int32_t indallvouts); pthread_mutex_t hush_mutex; diff --git a/src/hush_nSPV_fullnode.h b/src/hush_nSPV_fullnode.h index a33013b6a..be4fbce15 100644 --- a/src/hush_nSPV_fullnode.h +++ b/src/hush_nSPV_fullnode.h @@ -863,7 +863,7 @@ int32_t NSPV_getspentinfo(struct NSPV_spentinfo *ptr,uint256 txid,int32_t vout) return(len); } -void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a request +void hush_nSPVreq(CNode *pfrom,std::vector request) // received a request { int32_t len,slen,ind,reqheight,n; std::vector response; uint32_t timestamp = (uint32_t)time(NULL); if ( (len= request.size()) > 0 ) diff --git a/src/hush_nSPV_superlite.h b/src/hush_nSPV_superlite.h index aaa0c1724..585f905f0 100644 --- a/src/hush_nSPV_superlite.h +++ b/src/hush_nSPV_superlite.h @@ -128,9 +128,9 @@ struct NSPV_ntzsproofresp *NSPV_ntzsproof_add(struct NSPV_ntzsproofresp *ptr) return(&NSPV_ntzsproofresp_cache[i]); } -// komodo_nSPVresp is called from async message processing +// hush_nSPVresp is called from async message processing -void komodo_nSPVresp(CNode *pfrom,std::vector response) // received a response +void hush_nSPVresp(CNode *pfrom,std::vector response) // received a response { struct NSPV_inforesp I; int32_t len; uint32_t timestamp = (uint32_t)time(NULL); strncpy(NSPV_lastpeer,pfrom->addr.ToString().c_str(),sizeof(NSPV_lastpeer)-1); @@ -274,9 +274,9 @@ UniValue NSPV_logout() return(result); } -// komodo_nSPV from main polling loop (really this belongs in its own file, but it is so small, it ended up here) +// hush_nSPV from main polling loop (really this belongs in its own file, but it is so small, it ended up here) -void komodo_nSPV(CNode *pto) // polling loop from SendMessages +void hush_nSPV(CNode *pto) // polling loop from SendMessages { uint8_t msg[256]; int32_t i,len=0; uint32_t timestamp = (uint32_t)time(NULL); if ( NSPV_logintime != 0 && timestamp > NSPV_logintime+NSPV_AUTOLOGOUT ) diff --git a/src/hush_notary.h b/src/hush_notary.h index a8f792f8f..d9aa60860 100644 --- a/src/hush_notary.h +++ b/src/hush_notary.h @@ -246,7 +246,7 @@ int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,ui //struct hush_state *hush_stateptr(char *symbol,char *dest); -struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx) +struct notarized_checkpoint *hush_npptr_for_height(int32_t height, int *idx) { char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; int32_t i; struct hush_state *sp; struct notarized_checkpoint *np = 0; if ( (sp= hush_stateptr(symbol,dest)) != 0 ) @@ -263,13 +263,13 @@ struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx) return(0); } -struct notarized_checkpoint *komodo_npptr(int32_t height) +struct notarized_checkpoint *hush_npptr(int32_t height) { int idx; - return komodo_npptr_for_height(height, &idx); + return hush_npptr_for_height(height, &idx); } -struct notarized_checkpoint *komodo_npptr_at(int idx) +struct notarized_checkpoint *hush_npptr_at(int idx) { char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp; if ( (sp= hush_stateptr(symbol,dest)) != 0 ) @@ -278,7 +278,7 @@ struct notarized_checkpoint *komodo_npptr_at(int idx) return(0); } -int32_t komodo_prevMoMheight() +int32_t hush_prevMoMheight() { static uint256 zero; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; int32_t i; struct hush_state *sp; struct notarized_checkpoint *np = 0; @@ -314,7 +314,7 @@ int32_t hush_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *tx { *hashp = sp->NOTARIZED_HASH; *txidp = sp->NOTARIZED_DESTTXID; - *prevMoMheightp = komodo_prevMoMheight(); + *prevMoMheightp = hush_prevMoMheight(); } return(sp->NOTARIZED_HEIGHT); } else return(0); @@ -342,7 +342,7 @@ int32_t hush_dpowconfs(int32_t txheight,int32_t numconfs) int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) { struct notarized_checkpoint *np = 0; - if ( (np= komodo_npptr(height)) != 0 ) + if ( (np= hush_npptr(height)) != 0 ) { *notarized_htp = np->notarized_height; *MoMp = np->MoM; diff --git a/src/hush_pax.h b/src/hush_pax.h index 242e4d0fe..fe2f946ad 100644 --- a/src/hush_pax.h +++ b/src/hush_pax.h @@ -133,7 +133,7 @@ uint64_t peggy_smooth_coeffs[sizeof(Peggy_inds)/sizeof(*Peggy_inds)] = // numpri 1, 1, 1, 1, 1, 1, 0, 0, // isum 100000000000 }; -uint64_t komodo_maxallowed(int32_t baseid) +uint64_t hush_maxallowed(int32_t baseid) { uint64_t mult,val = COIN * (uint64_t)10000; if ( baseid < 0 || baseid >= 32 ) @@ -144,7 +144,7 @@ uint64_t komodo_maxallowed(int32_t baseid) return(mult * val); } -uint64_t komodo_paxvol(uint64_t volume,uint64_t price) +uint64_t hush_paxvol(uint64_t volume,uint64_t price) { if ( volume < 10000000000 ) return((volume * price) / 1000000000); @@ -170,7 +170,7 @@ void pax_rank(uint64_t *ranked,uint32_t *pvals) int32_t i; uint64_t vals[32],sum = 0; for (i=0; i<32; i++) { - vals[i] = komodo_paxvol(M1SUPPLY[i] / MINDENOMS[i],pvals[i]); + vals[i] = hush_paxvol(M1SUPPLY[i] / MINDENOMS[i],pvals[i]); sum += vals[i]; } for (i=0; i<32; i++) @@ -228,11 +228,11 @@ double PAX_val(uint32_t pval,int32_t baseid) return(0.); } -void komodo_pvals(int32_t height,uint32_t *pvals,uint8_t numpvals) +void hush_pvals(int32_t height,uint32_t *pvals,uint8_t numpvals) { } -uint64_t komodo_paxcorrelation(uint64_t *votes,int32_t numvotes,uint64_t seed) +uint64_t hush_paxcorrelation(uint64_t *votes,int32_t numvotes,uint64_t seed) { int32_t i,j,k,ind,zeroes,wt,nonz; int64_t delta; uint64_t lastprice,tolerance,den,densum,sum=0; for (sum=i=zeroes=nonz=0; i= 0x4c ) @@ -2292,7 +2292,7 @@ void hush_args(char *argv0) extralen += symbol.size(); } } - //komodo_pricesinit(); + //hush_pricesinit(); hush_cbopretupdate(1); // will set Mineropret fprintf(stderr,"This blockchain uses data produced from CoinDesk Bitcoin Price Index\n"); } @@ -2325,7 +2325,7 @@ void hush_args(char *argv0) if ( (baseid = hush_baseid(SMART_CHAIN_SYMBOL)) >= 0 && baseid < 32 ) { - //komodo_maxallowed(baseid); + //hush_maxallowed(baseid); if(fDebug) printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,SMART_CHAIN_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); } @@ -2381,7 +2381,7 @@ void hush_args(char *argv0) if ( ASSETCHAINS_RPCPORT == 0 ) ASSETCHAINS_RPCPORT = ASSETCHAINS_P2PPORT + 1; //ASSETCHAINS_NOTARIES = GetArg("-ac_notaries",""); - //komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str()); + //hush_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str()); dragon_rwnum(1,magic,sizeof(ASSETCHAINS_MAGIC),(void *)&ASSETCHAINS_MAGIC); for (i=0; i<4; i++) sprintf(&magicstr[i<<1],"%02x",magic[i]); diff --git a/src/main.cpp b/src/main.cpp index eabed2626..537016343 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -82,7 +82,7 @@ int32_t hush_block2pubkey33(uint8_t *pubkey33,CBlock *block); bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); void hush_setactivation(int32_t height); void hush_changeblocktime(); -void komodo_pricesupdate(int32_t height,CBlock *pblock); +void hush_pricesupdate(int32_t height,CBlock *pblock); BlockMap mapBlockIndex; CChain chainActive; CBlockIndex *pindexBestHeader = NULL; @@ -1423,7 +1423,7 @@ bool CheckTransaction(uint32_t tiptime,const CTransaction& tx, CValidationState { static uint256 array[64]; static int32_t numbanned,indallvouts; int32_t j,k,n; if ( *(int32_t *)&array[0] == 0 ) - numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array))); + numbanned = hush_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array))); n = tx.vin.size(); if ( SMART_CHAIN_SYMBOL[0] == 0 ) { @@ -4041,7 +4041,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * { //fprintf(stderr,"%s: HUSH_NSPV_FULLNODE\n", __FUNCTION__); if ( ASSETCHAINS_CBOPRET != 0 ) - komodo_pricesupdate(pindexNew->GetHeight(),pblock); + hush_pricesupdate(pindexNew->GetHeight(),pblock); if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > HUSH_SAPING_ACTIVATION - 24*3600 ) hush_activate_sapling(pindexNew); if ( ASSETCHAINS_CC != 0 && HUSH_SNAPSHOT_INTERVAL != 0 && (pindexNew->GetHeight() % HUSH_SNAPSHOT_INTERVAL) == 0 && pindexNew->GetHeight() >= HUSH_SNAPSHOT_INTERVAL ) @@ -4472,7 +4472,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block) if (it != mapBlockIndex.end()) { - if ( it->second != 0 ) // vNodes.size() >= HUSH_LIMITED_NETWORKSIZE, change behavior to allow komodo_ensure to work + if ( it->second != 0 ) // vNodes.size() >= HUSH_LIMITED_NETWORKSIZE { // this is the strange case where somehow the hash is in the mapBlockIndex via as yet undetermined process, but the pindex for the hash is not there. Theoretically it is due to processing the block headers, but I have seen it get this case without having received it from the block headers or anywhere else... jl777 //fprintf(stderr,"addtoblockindex already there %p\n",it->second); @@ -4480,7 +4480,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block) } if ( miPrev != mapBlockIndex.end() && (*miPrev).second == 0 ) { - //fprintf(stderr,"edge case of both block and prevblock in the strange state\n"); + fprintf(stderr,"%s: edge case of both block and prevblock in the strange state\n", __func__); return(0); // return here to avoid the state of pindex->GetHeight() not set and pprev NULL } } @@ -7075,7 +7075,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } std::vector payload; vRecv >> payload; - komodo_netevent(payload); + hush_netevent(payload); return(true); } else if (strCommand == "verack") { pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); @@ -7275,7 +7275,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, { std::vector payload; vRecv >> payload; - komodo_nSPVreq(pfrom,payload); + hush_nSPVreq(pfrom,payload); } return(true); } else if (strCommand == "nSPV") { @@ -7283,7 +7283,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, { std::vector payload; vRecv >> payload; - komodo_nSPVresp(pfrom,payload); + hush_nSPVresp(pfrom,payload); } return(true); } @@ -8010,7 +8010,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) } if ( HUSH_NSPV_SUPERLITE ) { - komodo_nSPV(pto); + hush_nSPV(pto); return(true); } BOOST_FOREACH(const CBlockReject& reject, state.rejects) diff --git a/src/miner.cpp b/src/miner.cpp index 2f4b7495e..02d52abcd 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -147,8 +147,8 @@ int32_t hush_is_notarytx(const CTransaction& tx); uint64_t hush_notarypay(CMutableTransaction &txNew, std::vector &NotarizationNotaries, uint32_t timestamp, int32_t height, uint8_t *script, int32_t len); int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); int32_t hush_getnotarizedheight(uint32_t timestamp,int32_t height, uint8_t *script, int32_t len); -CScript komodo_mineropret(int32_t nHeight); -bool komodo_appendACscriptpub(); +CScript hush_mineropret(int32_t nHeight); +bool hush_appendACscriptpub(); CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32_t gpucount, bool isStake) { @@ -167,7 +167,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 } } else pk = _pk; - uint64_t deposits,voutsum=0; int32_t isrealtime,kmdheight; uint32_t blocktime; const CChainParams& chainparams = Params(); + uint64_t deposits,voutsum=0; int32_t isrealtime,hushheight; uint32_t blocktime; const CChainParams& chainparams = Params(); bool fNotarizationBlock = false; std::vector NotarizationNotaries; //fprintf(stderr,"create new block\n"); @@ -612,7 +612,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 if ( ASSETCHAINS_SCRIPTPUB.size() > 1 ) { static bool didinit = false; - if ( !didinit && nHeight > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && komodo_appendACscriptpub() ) + if ( !didinit && nHeight > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() ) { fprintf(stderr, "appended ccopreturn to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str()); didinit = true; @@ -667,7 +667,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 int32_t numv = (int32_t)txNew.vout.size(); txNew.vout.resize(numv+1); txNew.vout[numv].nValue = 0; - txNew.vout[numv].scriptPubKey = komodo_mineropret(nHeight); + txNew.vout[numv].scriptPubKey = hush_mineropret(nHeight); //printf("autocreate commision/cbopret.%lld vout[%d]\n",(long long)ASSETCHAINS_CBOPRET,(int32_t)txNew.vout.size()); } pblock->vtx[0] = txNew; @@ -879,7 +879,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight, return CreateNewBlock(pubkey, scriptPubKey, gpucount, isStake); } -void komodo_sendmessage(int32_t minpeers,int32_t maxpeers,const char *message,std::vector payload) +void hush_sendmessage(int32_t minpeers,int32_t maxpeers,const char *message,std::vector payload) { int32_t numsent = 0; LOCK(cs_vNodes); @@ -956,7 +956,7 @@ static bool ProcessBlockFound(CBlock* pblock) int32_t hush_baseid(char *origbase); int32_t hush_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t *blocktimes,int32_t *nonzpkeysp,int32_t height); -arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc); +arith_uint256 hush_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc); int32_t FOUND_BLOCK,HUSH_MAYBEMINED; extern int32_t HUSH_LASTMINED,HUSH_INSYNC; int32_t roundrobin_delay; @@ -1237,7 +1237,7 @@ void static BitcoinMiner() } else Mining_start = 0; //else if ( ASSETCHAINS_ADAPTIVEPOW > 0 ) - // HASHTarget_POW = komodo_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime); + // HASHTarget_POW = hush_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime); gotinvalid = 0; while (true) { @@ -1462,7 +1462,7 @@ void static BitcoinMiner() HASHTarget.SetCompact(pblock->nBits); hashTarget = HASHTarget; savebits = pblock->nBits; - //hashTarget = HASHTarget_POW = komodo_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime); + //hashTarget = HASHTarget_POW = hush_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime); } /*if ( NOTARY_PUBKEY33[0] == 0 ) { @@ -1472,7 +1472,7 @@ void static BitcoinMiner() { // Changing pblock->nTime can change work required on testnet: HASHTarget.SetCompact(pblock->nBits); - HASHTarget_POW = komodo_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED); + HASHTarget_POW = hush_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED); } }*/ } diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index bf38cc5e2..6bd65e40f 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1027,7 +1027,7 @@ UniValue notaries(const UniValue& params, bool fHelp, const CPubKey& mypk) return ret; } -int32_t komodo_pending_withdraws(char *opretstr); +int32_t hush_pending_withdraws(char *opretstr); int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,uint64_t *approved,uint64_t *redeemed,char *base); extern char CURRENCIES[][8]; @@ -1037,7 +1037,7 @@ UniValue paxpending(const UniValue& params, bool fHelp, const CPubKey& mypk) if ( fHelp || params.size() != 0 ) throw runtime_error("paxpending needs no args\n"); LOCK(cs_main); - if ( (opretlen= komodo_pending_withdraws(opretbuf)) > 0 ) + if ( (opretlen= hush_pending_withdraws(opretbuf)) > 0 ) ret.push_back(Pair("withdraws", opretbuf)); else ret.push_back(Pair("withdraws", (char *)"")); for (baseid=0; baseid<32; baseid++) @@ -1076,7 +1076,7 @@ UniValue paxprice(const UniValue& params, bool fHelp, const CPubKey& mypk) else height = atoi(params[2].get_str().c_str()); //if ( params.size() == 3 || (basevolume= COIN * atof(params[3].get_str().c_str())) == 0 ) basevolume = 100000; - relvolume = komodo_paxprice(&seed,height,(char *)base.c_str(),(char *)rel.c_str(),basevolume); + relvolume = hush_paxprice(&seed,height,(char *)base.c_str(),(char *)rel.c_str(),basevolume); ret.push_back(Pair("base", base)); ret.push_back(Pair("rel", rel)); ret.push_back(Pair("height", height)); diff --git a/src/rpc/crosschain.cpp b/src/rpc/crosschain.cpp index 375bbfbd5..7de8a5d7a 100644 --- a/src/rpc/crosschain.cpp +++ b/src/rpc/crosschain.cpp @@ -57,8 +57,8 @@ bool EnsureWalletIsAvailable(bool avoidException); int32_t hush_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip); -int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height); -struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi); +int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t hushheight,int32_t notarized_height); +struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi); uint256 hush_calcMoM(int32_t height,int32_t MoMdepth); int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); extern std::string ASSETCHAINS_SELFIMPORT; diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index d179bd590..ab6a75e96 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -52,7 +52,7 @@ using namespace std; extern int32_t ASSETCHAINS_FOUNDERS; uint64_t the_commission(const CBlock *pblock,int32_t height); int32_t hush_blockload(CBlock& block,CBlockIndex *pindex); -arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc); +arith_uint256 hush_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc); /** * Return average network hashes per second based on the last 'lookup' blocks, diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index f7cc48433..c2a8484e0 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -614,7 +614,7 @@ int32_t hush_opreturnscript(uint8_t *script,uint8_t type,uint8_t *opret,int32_t extern int32_t HUSH_PAX; int32_t hush_is_issuer(); int32_t dragon_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endianedp); -int32_t hush_isrealtime(int32_t *kmdheightp); +int32_t hush_isrealtime(int32_t *hushheightp); int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,uint64_t *approved,uint64_t *redeemed,char *base); int32_t hush_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[DRAGON_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen); int32_t hush_kvcmp(uint8_t *refvalue,uint16_t refvaluesize,uint8_t *value,uint16_t valuesize); @@ -768,7 +768,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk) UniValue paxdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk) { - uint64_t available,deposited,issued,withdrawn,approved,redeemed,seed,komodoshis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33]; + uint64_t available,deposited,issued,withdrawn,approved,redeemed,seed,puposhis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33]; bool fSubtractFeeFromAmount = false; if ( HUSH_PAX == 0 ) { @@ -793,28 +793,28 @@ UniValue paxdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk) fprintf(stderr,"available %llu vs fiatoshis %llu\n",(long long)available,(long long)fiatoshis); throw runtime_error("paxdeposit not enough available inventory"); } - komodoshis = PAX_fiatdest(&seed,0,destaddr,pubkey37,(char *)params[0].get_str().c_str(),height,(char *)base.c_str(),fiatoshis); + puposhis = PAX_fiatdest(&seed,0,destaddr,pubkey37,(char *)params[0].get_str().c_str(),height,(char *)base.c_str(),fiatoshis); dest.append(destaddr); CBitcoinAddress destaddress(CRYPTO555_HUSHADDR); if (!destaddress.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid dest Bitcoin address"); for (i=0; i<33; i++) fprintf(stderr,"%02x",pubkey37[i]); - fprintf(stderr," ht.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",height,(char *)params[0].get_str().c_str(),(char *)base.c_str(),(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed); + fprintf(stderr," ht.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) puposhis.%llu seed.%llx\n",height,(char *)params[0].get_str().c_str(),(char *)base.c_str(),(long long)fiatoshis,destaddr,(long long)puposhis,(long long)seed); EnsureWalletIsUnlocked(); CWalletTx wtx; - uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = komodoshis / 1000; + uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = puposhis / 1000; if ( fee < 10000 ) fee = 10000; dragon_rwnum(1,&pubkey37[33],sizeof(height),&height); opretlen = hush_opreturnscript(opretbuf,'D',pubkey37,37); - SendMoney(address.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,komodoshis); + SendMoney(address.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,puposhis); return wtx.GetHash().GetHex(); } UniValue paxwithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk) { - CWalletTx wtx; std::string dest; int32_t kmdheight; uint64_t seed,komodoshis = 0; char destaddr[64]; uint8_t i,pubkey37[37]; bool fSubtractFeeFromAmount = false; + CWalletTx wtx; std::string dest; int32_t hushheight; uint64_t seed,puposhis = 0; char destaddr[64]; uint8_t i,pubkey37[37]; bool fSubtractFeeFromAmount = false; if ( SMART_CHAIN_SYMBOL[0] == 0 ) return(0); if (!EnsureWalletIsAvailable(fHelp)) @@ -822,26 +822,26 @@ UniValue paxwithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk) throw runtime_error("paxwithdraw deprecated"); if (fHelp || params.size() != 2) throw runtime_error("paxwithdraw address fiatamount"); - if ( hush_isrealtime(&kmdheight) == 0 ) + if ( hush_isrealtime(&hushheight) == 0 ) return(0); LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address"); int64_t fiatoshis = atof(params[1].get_str().c_str()) * COIN; - komodoshis = PAX_fiatdest(&seed,1,destaddr,pubkey37,(char *)params[0].get_str().c_str(),kmdheight,SMART_CHAIN_SYMBOL,fiatoshis); + puposhis = PAX_fiatdest(&seed,1,destaddr,pubkey37,(char *)params[0].get_str().c_str(),hushheight,SMART_CHAIN_SYMBOL,fiatoshis); dest.append(destaddr); CBitcoinAddress destaddress(CRYPTO555_HUSHADDR); if (!destaddress.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid dest Bitcoin address"); for (i=0; i<33; i++) printf("%02x",pubkey37[i]); - printf(" kmdheight.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",kmdheight,(char *)params[0].get_str().c_str(),SMART_CHAIN_SYMBOL,(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed); + printf(" hushheight.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) puposhis.%llu seed.%llx\n",hushheight,(char *)params[0].get_str().c_str(),SMART_CHAIN_SYMBOL,(long long)fiatoshis,destaddr,(long long)puposhis,(long long)seed); EnsureWalletIsUnlocked(); uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = fiatoshis / 1000; if ( fee < 10000 ) fee = 10000; - dragon_rwnum(1,&pubkey37[33],sizeof(kmdheight),&kmdheight); + dragon_rwnum(1,&pubkey37[33],sizeof(hushheight),&hushheight); opretlen = hush_opreturnscript(opretbuf,'W',pubkey37,37); SendMoney(destaddress.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,fiatoshis); return wtx.GetHash().GetHex(); From 4f15626bb0223252854509899d4d97fd0d9ad652 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 14:24:27 -0400 Subject: [PATCH 07/16] Cleanup --- src/hush.h | 4 ++-- src/hush_bitcoind.h | 4 ++-- src/hush_ccdata.h | 24 ++++++++++++------------ src/hush_gateway.h | 18 +++++++++--------- src/hush_globals.h | 2 +- src/hush_notary.h | 8 ++++---- src/hush_structs.h | 4 ++-- src/rpc/blockchain.cpp | 16 ++++++++-------- src/rpc/crosschain.cpp | 12 ++++++------ src/stratum.cpp | 5 ++--- src/zcash/JoinSplit.cpp | 2 -- 11 files changed, 48 insertions(+), 51 deletions(-) diff --git a/src/hush.h b/src/hush.h index 63bbf3dbe..ee9f608f2 100644 --- a/src/hush.h +++ b/src/hush.h @@ -653,8 +653,8 @@ int32_t hush_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notaryi // MoMoM, depth, numpairs, (notarization ht, MoMoM offset) if ( len+48-opoffset <= opretlen && strcmp(ccdata.symbol,SMART_CHAIN_SYMBOL) == 0 ) { - len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.kmdstarti); - len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.kmdendi); + len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.hushstarti); + len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.hushendi); len += dragon_rwbignum(0,&scriptbuf[len],sizeof(MoMoMdata.MoMoM),(uint8_t *)&MoMoMdata.MoMoM); len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.MoMoMdepth); len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.numpairs); diff --git a/src/hush_bitcoind.h b/src/hush_bitcoind.h index df299d6dd..0aefbcccf 100644 --- a/src/hush_bitcoind.h +++ b/src/hush_bitcoind.h @@ -868,10 +868,10 @@ int32_t hush_minerids(uint8_t *minerids,int32_t height,int32_t width) return(nonz); } -int32_t hush_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) +int32_t hush_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *hushstartip,int32_t *hushendip) { int32_t depth,notarized_ht; uint256 MoM,hushtxid; - depth = hush_MoMdata(¬arized_ht,&MoM,&hushtxid,nHeight,MoMoMp,MoMoMoffsetp,MoMoMdepthp,kmdstartip,kmdendip); + depth = hush_MoMdata(¬arized_ht,&MoM,&hushtxid,nHeight,MoMoMp,MoMoMoffsetp,MoMoMdepthp,hushstartip,hushendip); memset(MoMp,0,sizeof(*MoMp)); memset(hushtxidp,0,sizeof(*hushtxidp)); *notarized_heightp = 0; diff --git a/src/hush_ccdata.h b/src/hush_ccdata.h index 420a7243e..498419ab1 100644 --- a/src/hush_ccdata.h +++ b/src/hush_ccdata.h @@ -41,7 +41,7 @@ uint256 hush_calcMoM(int32_t height,int32_t MoMdepth) return BuildMerkleTree(&fMutated, leaves, tree); } -struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi) +struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t hushstarti,int32_t hushendi) { struct hush_ccdata_entry *allMoMs=0; struct hush_ccdata *ccdata,*tmpptr; int32_t i,num,max; bool fMutated; std::vector tree, leaves; @@ -49,7 +49,7 @@ struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmd portable_mutex_lock(&HUSH_CC_mutex); DL_FOREACH_SAFE(CC_data,ccdata,tmpptr) { - if ( ccdata->MoMdata.height <= kmdendi && ccdata->MoMdata.height >= kmdstarti ) + if ( ccdata->MoMdata.height <= hushendi && ccdata->MoMdata.height >= hushstarti ) { if ( num >= max ) { @@ -63,7 +63,7 @@ struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmd strcpy(allMoMs[num].symbol,ccdata->symbol); num++; } - if ( ccdata->MoMdata.height < kmdstarti ) + if ( ccdata->MoMdata.height < hushstarti ) break; } portable_mutex_unlock(&HUSH_CC_mutex); @@ -116,7 +116,7 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda { if ( ccdata->MoMdata.height < hushheight ) { - //fprintf(stderr,"%s notarized.%d kmd.%d\n",ccdata->symbol,ccdata->MoMdata.notarized_height,ccdata->MoMdata.height); + //fprintf(stderr,"%s notarized.%d HUSH3.%d\n",ccdata->symbol,ccdata->MoMdata.notarized_height,ccdata->MoMdata.height); if ( strcmp(ccdata->symbol,symbol) == 0 ) { if ( endi == 0 ) @@ -136,8 +136,8 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda } } portable_mutex_unlock(&HUSH_CC_mutex); - mdata->kmdstarti = starti; - mdata->kmdendi = endi; + mdata->hushstarti = starti; + mdata->hushendi = endi; if ( starti != 0 && endi != 0 && endi >= starti ) { if ( (allMoMs= hush_allMoMs(&depth,&mdata->MoMoM,starti,endi)) != 0 ) @@ -151,8 +151,8 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda if ( mdata->numpairs > 0 ) { len += dragon_rwnum(1,&hexdata[len],sizeof(CCid),(uint8_t *)&CCid); - len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->kmdstarti); - len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->kmdendi); + len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->hushstarti); + len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->hushendi); len += dragon_rwbignum(1,&hexdata[len],sizeof(mdata->MoMoM),(uint8_t *)&mdata->MoMoM); len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->MoMoMdepth); len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->numpairs); @@ -255,12 +255,12 @@ int32_t hush_rwccdata(char *thischain,int32_t rwflag,struct hush_ccdata *ccdata, np->MoMoM = MoMoMdata->MoMoM; np->MoMoMdepth = MoMoMdata->MoMoMdepth; np->MoMoMoffset = MoMoMdata->MoMoMoffset; - np->kmdstarti = MoMoMdata->kmdstarti; - np->kmdendi = MoMoMdata->kmdendi; + np->hushstarti = MoMoMdata->hushstarti; + np->hushendi = MoMoMdata->hushendi; } - else if ( memcmp(&np->MoMoM,&MoMoMdata->MoMoM,sizeof(np->MoMoM)) != 0 || np->MoMoMdepth != MoMoMdata->MoMoMdepth || np->MoMoMoffset != MoMoMdata->MoMoMoffset || np->kmdstarti != MoMoMdata->kmdstarti || np->kmdendi != MoMoMdata->kmdendi ) + else if ( memcmp(&np->MoMoM,&MoMoMdata->MoMoM,sizeof(np->MoMoM)) != 0 || np->MoMoMdepth != MoMoMdata->MoMoMdepth || np->MoMoMoffset != MoMoMdata->MoMoMoffset || np->hushstarti != MoMoMdata->hushstarti || np->hushendi != MoMoMdata->hushendi ) { - fprintf(stderr,"preexisting MoMoM mismatch: %s (%d %d %d %d) vs %s (%d %d %d %d)\n",np->MoMoM.ToString().c_str(),np->MoMoMdepth,np->MoMoMoffset,np->kmdstarti,np->kmdendi,MoMoMdata->MoMoM.ToString().c_str(),MoMoMdata->MoMoMdepth,MoMoMdata->MoMoMoffset,MoMoMdata->kmdstarti,MoMoMdata->kmdendi); + fprintf(stderr,"preexisting MoMoM mismatch: %s (%d %d %d %d) vs %s (%d %d %d %d)\n",np->MoMoM.ToString().c_str(),np->MoMoMdepth,np->MoMoMoffset,np->hushstarti,np->hushendi,MoMoMdata->MoMoM.ToString().c_str(),MoMoMdata->MoMoMdepth,MoMoMdata->MoMoMoffset,MoMoMdata->hushstarti,MoMoMdata->hushendi); } } } diff --git a/src/hush_gateway.h b/src/hush_gateway.h index b52ab8a1e..2f701cfb6 100644 --- a/src/hush_gateway.h +++ b/src/hush_gateway.h @@ -350,7 +350,7 @@ uint64_t hush_paxtotal() //int32_t j; for (j=0; j<32; j++) // printf("%02x",((uint8_t *)&pax->txid)[j]); //if ( strcmp(str,SMART_CHAIN_SYMBOL) == 0 ) - // printf(" v%d %p got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->vout,pax,pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->puposhis),dstr(checktoshis)); + // printf(" v%d %p got WITHDRAW.%s HUSH3.%d ht.%d %.8f -> %.8f/%.8f\n",pax->vout,pax,pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->puposhis),dstr(checktoshis)); } } } @@ -453,7 +453,7 @@ int32_t hush_pending_withdraws(char *opretstr) // todo: enforce deterministic or paxes[n++] = pax; //int32_t j; for (j=0; j<32; j++) // printf("%02x",((uint8_t *)&pax->txid)[j]); - //printf(" %s.(kmdht.%d ht.%d marked.%u approved.%d validated %.8f) %.8f\n",pax->source,pax->height,pax->otherheight,pax->marked,pax->approved,dstr(pax->validated),dstr(pax->puposhis)); + //printf(" %s.(ht.%d ht.%d marked.%u approved.%d validated %.8f) %.8f\n",pax->source,pax->height,pax->otherheight,pax->marked,pax->approved,dstr(pax->validated),dstr(pax->puposhis)); } } } @@ -480,7 +480,7 @@ int32_t hush_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t toko struct pax_transaction *pax,*tmp; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; uint8_t *script,opcode,opret[16384*4],data[16384*4]; int32_t i,baseid,ht,len=0,opretlen=0,numvouts=1; struct hush_state *sp; uint64_t available,deposited,issued,withdrawn,approved,redeemed,mask,sum = 0; if ( HUSH_PASSPORT_INITDONE == 0 )//HUSH_PAX == 0 || return(0); - struct hush_state *kmdsp = hush_stateptrget((char *)"HUSH3"); + struct hush_state *hushsp = hush_stateptrget((char *)"HUSH3"); sp = hush_stateptr(symbol,dest); strcpy(symbol,base); if ( SMART_CHAIN_SYMBOL[0] != 0 && hush_baseid(SMART_CHAIN_SYMBOL) < 0 ) @@ -516,14 +516,14 @@ int32_t hush_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t toko #ifdef HUSH_SMART_CHAINS_WAITNOTARIZE if ( pax->height > 236000 ) { - if ( kmdsp != 0 && kmdsp->NOTARIZED_HEIGHT >= pax->height ) + if ( hushsp != 0 && hushsp->NOTARIZED_HEIGHT >= pax->height ) pax->validated = pax->puposhis; - else if ( kmdsp->CURRENT_HEIGHT > pax->height+30 ) + else if ( hushsp->CURRENT_HEIGHT > pax->height+30 ) pax->validated = pax->ready = 0; } else { - if ( kmdsp != 0 && (kmdsp->NOTARIZED_HEIGHT >= pax->height || kmdsp->CURRENT_HEIGHT > pax->height+30) ) // assumes same chain as notarize + if ( hushsp != 0 && (hushsp->NOTARIZED_HEIGHT >= pax->height || hushsp->CURRENT_HEIGHT > pax->height+30) ) // assumes same chain as notarize pax->validated = pax->puposhis; else pax->validated = pax->ready = 0; } @@ -546,7 +546,7 @@ int32_t hush_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t toko if ( SMART_CHAIN_SYMBOL[0] != 0 && (strcmp(pax->symbol,symbol) != 0 || pax->validated == 0 || pax->ready == 0) ) { if ( strcmp(pax->symbol,SMART_CHAIN_SYMBOL) == 0 ) - printf("pax->symbol.%s != %s or null pax->validated %.8f ready.%d ht.(%d %d)\n",pax->symbol,symbol,dstr(pax->validated),pax->ready,kmdsp->CURRENT_HEIGHT,pax->height); + printf("pax->symbol.%s != %s or null pax->validated %.8f ready.%d ht.(%d %d)\n",pax->symbol,symbol,dstr(pax->validated),pax->ready,hushsp->CURRENT_HEIGHT,pax->height); pax->marked = pax->height; continue; } @@ -554,7 +554,7 @@ int32_t hush_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t toko continue; if ( pax->type == 'A' && SMART_CHAIN_SYMBOL[0] == 0 ) { - if ( kmdsp != 0 ) + if ( hushsp != 0 ) { if ( (baseid= hush_baseid(pax->symbol)) < 0 || ((1LL << baseid) & sp->RTmask) == 0 ) { @@ -1019,7 +1019,7 @@ const char *hush_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_ printf("########### %p withdrawn %s += %.8f check %.8f\n",basesp,base,dstr(value),dstr(checktoshis)); } if ( 0 && strcmp(base,"RUB") == 0 && (pax == 0 || pax->approved == 0) ) - printf("notarize %s %.8f -> %.8f kmd.%d other.%d\n",SMART_CHAIN_SYMBOL,dstr(value),dstr(puposhis),hushheight,height); + printf("notarize %s %.8f -> %.8f HUSH3.%d other.%d\n",SMART_CHAIN_SYMBOL,dstr(value),dstr(puposhis),hushheight,height); } hush_gateway_deposit(coinaddr,0,(char *)"HUSH3",value,rmd160,txid,vout,'W',hushheight,height,source,0); if ( (pax= hush_paxfind(txid,vout,'W')) != 0 ) diff --git a/src/hush_globals.h b/src/hush_globals.h index ebb074d03..7e0a4c17f 100644 --- a/src/hush_globals.h +++ b/src/hush_globals.h @@ -21,7 +21,7 @@ void hush_prefetch(FILE *fp); uint32_t hush_heightstamp(int32_t height); void hush_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint32_t ktime,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth); void hush_init(int32_t height); -int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip); +int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *hushstartip,int32_t *hushendip); int32_t hush_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp); char *hush_issuemethod(char *userpass,char *method,char *params,uint16_t port); void hush_init(int32_t height); diff --git a/src/hush_notary.h b/src/hush_notary.h index d9aa60860..6090b4f86 100644 --- a/src/hush_notary.h +++ b/src/hush_notary.h @@ -339,7 +339,7 @@ int32_t hush_dpowconfs(int32_t txheight,int32_t numconfs) return(numconfs); } -int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) +int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *hushstartip,int32_t *hushendip) { struct notarized_checkpoint *np = 0; if ( (np= hush_npptr(height)) != 0 ) @@ -350,11 +350,11 @@ int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int *MoMoMp = np->MoMoM; *MoMoMoffsetp = np->MoMoMoffset; *MoMoMdepthp = np->MoMoMdepth; - *kmdstartip = np->kmdstarti; - *kmdendip = np->kmdendi; + *hushstartip = np->hushstarti; + *hushendip = np->hushendi; return(np->MoMdepth & 0xffff); } - *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0; + *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *hushstartip = *hushendip = 0; memset(MoMp,0,sizeof(*MoMp)); memset(MoMoMp,0,sizeof(*MoMoMp)); memset(hushtxidp,0,sizeof(*hushtxidp)); diff --git a/src/hush_structs.h b/src/hush_structs.h index 1413f7cb3..121100b55 100644 --- a/src/hush_structs.h +++ b/src/hush_structs.h @@ -88,7 +88,7 @@ struct knotaries_entry { int32_t height,numnotaries; struct knotary_entry *Notar struct notarized_checkpoint { uint256 notarized_hash,notarized_desttxid,MoM,MoMoM; - int32_t nHeight,notarized_height,MoMdepth,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi; + int32_t nHeight,notarized_height,MoMdepth,MoMoMdepth,MoMoMoffset,hushstarti,hushendi; }; struct hush_ccdataMoM @@ -103,7 +103,7 @@ struct hush_ccdatapair { int32_t notarized_height,MoMoMoffset; }; struct hush_ccdataMoMoM { uint256 MoMoM; - int32_t kmdstarti,kmdendi,MoMoMoffset,MoMoMdepth,numpairs,len; + int32_t hushstarti,hushendi,MoMoMoffset,MoMoMdepth,numpairs,len; struct hush_ccdatapair *pairs; }; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 6bd65e40f..5f3a54d2f 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -942,18 +942,18 @@ UniValue minerids(const UniValue& params, bool fHelp, const CPubKey& mypk) } for (i=0; i<64; i++) { - UniValue item(UniValue::VOBJ); std::string hex,hushaddress; char *hexstr,kmdaddr[64],*ptr; int32_t m; + UniValue item(UniValue::VOBJ); std::string hex,hushaddress; char *hexstr,hushaddr[64],*ptr; int32_t m; hex.resize(66); hexstr = (char *)hex.data(); for (j=0; j<33; j++) sprintf(&hexstr[j*2],"%02x",pubkeys[i][j]); item.push_back(Pair("notaryid", i)); - bitcoin_address(kmdaddr,60,pubkeys[i],33); - m = (int32_t)strlen(kmdaddr); + bitcoin_address(hushaddr,60,pubkeys[i],33); + m = (int32_t)strlen(hushaddr); hushaddress.resize(m); ptr = (char *)hushaddress.data(); - memcpy(ptr,kmdaddr,m); + memcpy(ptr,hushaddr,m); item.push_back(Pair("HUSHaddress", hushaddress)); item.push_back(Pair("pubkey", hex)); @@ -973,7 +973,7 @@ UniValue minerids(const UniValue& params, bool fHelp, const CPubKey& mypk) UniValue notaries(const UniValue& params, bool fHelp, const CPubKey& mypk) { - UniValue a(UniValue::VARR); uint32_t timestamp=0; UniValue ret(UniValue::VOBJ); int32_t i,j,n,m; char *hexstr; uint8_t pubkeys[64][33]; char btcaddr[64],kmdaddr[64],*ptr; + UniValue a(UniValue::VARR); uint32_t timestamp=0; UniValue ret(UniValue::VOBJ); int32_t i,j,n,m; char *hexstr; uint8_t pubkeys[64][33]; char btcaddr[64],hushaddr[64],*ptr; if ( fHelp || (params.size() != 1 && params.size() != 2) ) throw runtime_error("notaries height timestamp\n"); LOCK(cs_main); @@ -1011,11 +1011,11 @@ UniValue notaries(const UniValue& params, bool fHelp, const CPubKey& mypk) memcpy(ptr,btcaddr,m); item.push_back(Pair("BTCaddress", btcaddress)); - bitcoin_address(kmdaddr,60,pubkeys[i],33); - m = (int32_t)strlen(kmdaddr); + bitcoin_address(hushaddr,60,pubkeys[i],33); + m = (int32_t)strlen(hushaddr); hushaddress.resize(m); ptr = (char *)hushaddress.data(); - memcpy(ptr,kmdaddr,m); + memcpy(ptr,hushaddr,m); item.push_back(Pair("HUSHaddress", hushaddress)); a.push_back(item); } diff --git a/src/rpc/crosschain.cpp b/src/rpc/crosschain.cpp index 7de8a5d7a..d3e54dc68 100644 --- a/src/rpc/crosschain.cpp +++ b/src/rpc/crosschain.cpp @@ -56,9 +56,9 @@ int32_t ensure_CCrequirements(uint8_t evalcode); bool EnsureWalletIsAvailable(bool avoidException); -int32_t hush_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip); +int32_t hush_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *hushstartip,int32_t *hushendip); int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t hushheight,int32_t notarized_height); -struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi); +struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t hushstarti,int32_t hushendi); uint256 hush_calcMoM(int32_t height,int32_t MoMdepth); int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); extern std::string ASSETCHAINS_SELFIMPORT; @@ -93,7 +93,7 @@ UniValue crosschainproof(const UniValue& params, bool fHelp, const CPubKey& mypk UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk) { - int32_t height,depth,notarized_height,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi; uint256 MoM,MoMoM,hushtxid; uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR); + int32_t height,depth,notarized_height,MoMoMdepth,MoMoMoffset,hushstarti,hushendi; uint256 MoM,MoMoM,hushtxid; uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR); if ( fHelp || params.size() != 1 ) throw runtime_error("height_MoM height\n"); LOCK(cs_main); @@ -108,7 +108,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk) height = chainActive.Tip()->GetHeight(); } //fprintf(stderr,"height_MoM height.%d\n",height); - depth = hush_MoM(¬arized_height,&MoM,&hushtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi); + depth = hush_MoM(¬arized_height,&MoM,&hushtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&hushstarti,&hushendi); ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL))); ret.push_back(Pair("height",height)); ret.push_back(Pair("timestamp",(uint64_t)timestamp)); @@ -123,8 +123,8 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk) ret.push_back(Pair("MoMoM",MoMoM.GetHex())); ret.push_back(Pair("MoMoMoffset",MoMoMoffset)); ret.push_back(Pair("MoMoMdepth",MoMoMdepth)); - ret.push_back(Pair("kmdstarti",kmdstarti)); - ret.push_back(Pair("kmdendi",kmdendi)); + ret.push_back(Pair("hushstarti",hushstarti)); + ret.push_back(Pair("hushendi",hushendi)); } } else ret.push_back(Pair("error",(char *)"no MoM for height")); diff --git a/src/stratum.cpp b/src/stratum.cpp index 4dd30f524..cf5ee5ac6 100644 --- a/src/stratum.cpp +++ b/src/stratum.cpp @@ -2080,8 +2080,7 @@ UniValue rpc_stratum_setdifficulty (const UniValue& params, bool fHelp, const CP } else { if (ParseDouble(param_str, &hush_diff)) { - // kmd diff as a str passed - + // hush diff as a str passed // difficulty = difficulty_1_target / current_target arith_uint256 target; ccminer::hush_diff_to_target_equi((uint32_t *)&target, hush_diff); @@ -2091,7 +2090,7 @@ UniValue rpc_stratum_setdifficulty (const UniValue& params, bool fHelp, const CP throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid difficulty (not hex target, not hush_diff)"); } } else if (params[0].getType() == UniValue::VNUM) { - // kmd diff as a num passed + // hush diff as a num passed hush_diff = params[0].get_real(); // difficulty = difficulty_1_target / current_target diff --git a/src/zcash/JoinSplit.cpp b/src/zcash/JoinSplit.cpp index d381f3f4b..823d37d06 100644 --- a/src/zcash/JoinSplit.cpp +++ b/src/zcash/JoinSplit.cpp @@ -4,10 +4,8 @@ #include "JoinSplit.hpp" #include "prf.h" #include "sodium.h" - #include #include - #include "librustzcash.h" namespace libzcash { From 6bca401f93a492ab55bfdcb5012651fd994c9251 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 22:51:45 -0400 Subject: [PATCH 08/16] Bump version to 3.9.0 --- configure.ac | 4 ++-- src/clientversion.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 4f369aebd..42b4cfa0f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,8 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 3) -define(_CLIENT_VERSION_MINOR, 8) -define(_CLIENT_VERSION_REVISION, 1) +define(_CLIENT_VERSION_MINOR, 9) +define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_BUILD, 50) define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50))) define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1))) diff --git a/src/clientversion.h b/src/clientversion.h index 375f82690..a6ec2819c 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -29,7 +29,7 @@ //! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it // Must be kept in sync with configure.ac , ugh! #define CLIENT_VERSION_MAJOR 3 -#define CLIENT_VERSION_MINOR 8 +#define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_REVISION 0 #define CLIENT_VERSION_BUILD 50 From 0f45150aa4aa9431424ca83cf791eb60b65bfb23 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 22:57:42 -0400 Subject: [PATCH 09/16] Update dev docs --- doc/developer-notes.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 26be1e262..e453c762b 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -9,19 +9,28 @@ A fresh sync preserves peers.dat, so it will always be faster than a "fresh clon One way to do a fresh sync is: ``` -cd ~/.komodo/HUSH3 +cd ~/.hush/HUSH3 rm blocks chainstate database notarizations hushstate ``` +NOTE: The legacy directory is ~/.komodo/HUSH3 and hushd will use data from either, or ~/.hush/HUSH3 if both exist. + If you are using `zindex=1` then you need to also delete zindex.dat ``` -cd ~/.komodo/HUSH3 +cd ~/.hush/HUSH3 rm zindex.dat blocks chainstate database notarizations hushstate ``` It's possible to confused hush if you ran old code, stop, restart, and then write out zindex.dat that is incorrect, with later hushds will load from disk and believe. +# Making a new release of Hush + + * Update version in configure.ac and src/clientversion.h + * Run ./contrib/devtools/gen-manpages.sh, commit + push results + * Update checkpoints + * Update protocol version if necessary + # Testing a Branch @@ -37,17 +46,17 @@ git checkout zindexdb # we want to test a fresh sync, so backup current data TIME=`perl -e "print time"` -mv ~/.komodo/{HUSH3,HUSH3-backup-$TIME} -mkdir ~/.komodo/HUSH3 +mv ~/.hush/{HUSH3,HUSH3-backup-$TIME} +mkdir ~/.hush/HUSH3 # Use your previous config as a base -cp ~/.komodo/{HUSH3-backup-$TIME,HUSH3}/HUSH3.conf +cp ~/.hush/{HUSH3-backup-$TIME,HUSH3}/HUSH3.conf # Add zindex to your node -echo "zindex=1" >> ~/.komodo/HUSH3/HUSH3.conf +echo "zindex=1" >> ~/.hush/HUSH3/HUSH3.conf # This is optional but will likely speed up sync time greatly -cp ~/.komodo/{HUSH3-backup,HUSH3}/peers.dat +cp ~/.hush/{HUSH3-backup,HUSH3}/peers.dat # This log file is helpful for debugging more and will contain a history of the # size of the anonset at every block height @@ -77,7 +86,7 @@ These values should match on all nodes: We should also check a recent block height to verify it's working correctly. The big "test" for this `zindexdb` branch is: * If you stop a node, and restart, are the stats from `getchaintxtstats` correct, i.e. the anonset stats? For instance, `shielded_pool_size` should be close to 500000, if it's close to or exactly 0, something is wrong. - * Is there a new file called `zindex.dat` in `~/.komodo/HUSH3/` ? + * Is there a new file called `zindex.dat` in `~/.hush/HUSH3/` ? * Is `zindex.dat` 149 bytes ? # Coding From c1fa2fb723a6ef12c58d9b9be82f78c8840df185 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 22:58:40 -0400 Subject: [PATCH 10/16] dev docs --- doc/developer-notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/developer-notes.md b/doc/developer-notes.md index e453c762b..2f8d7bfdf 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -30,6 +30,8 @@ It's possible to confused hush if you ran old code, stop, restart, and then writ * Run ./contrib/devtools/gen-manpages.sh, commit + push results * Update checkpoints * Update protocol version if necessary + * Make Gitea release + * Make Git Tag (Gitea can do this) # Testing a Branch From b0a1395f21aece667c7e2a1073c5235ea391cf4e Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 23:02:09 -0400 Subject: [PATCH 11/16] Fix unix manpage stuff --- doc/man/Makefile.am | 2 +- doc/man/komodo-cli.1 | 90 ------ doc/man/komodo-tx.1 | 103 ------- doc/man/komodod.1 | 637 ------------------------------------------- 4 files changed, 1 insertion(+), 831 deletions(-) delete mode 100644 doc/man/komodo-cli.1 delete mode 100644 doc/man/komodo-tx.1 delete mode 100644 doc/man/komodod.1 diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index 98a1278d8..13be3322e 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -1 +1 @@ -dist_man1_MANS=komodod.1 komodo-cli.1 komodo-tx.1 +dist_man1_MANS=hushd.1 hush-cli.1 hush-tx.1 diff --git a/doc/man/komodo-cli.1 b/doc/man/komodo-cli.1 deleted file mode 100644 index b7d195400..000000000 --- a/doc/man/komodo-cli.1 +++ /dev/null @@ -1,90 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10. -.TH KOMODO-CLI "1" "December 2019" "komodo-cli v3.3.0" "User Commands" -.SH NAME -komodo-cli \- manual page for komodo-cli v3.3.0 -.SH DESCRIPTION -Komodo RPC client version v3.3.0\-bde7744d9 -.PP -In order to ensure you are adequately protecting your privacy when using Hush, -please see . -.SS "Usage:" -.TP -komodo\-cli [options] [params] -Send command to Komodo -.TP -komodo\-cli [options] help -List commands -.TP -komodo\-cli [options] help -Get help for a command -.SH OPTIONS -.HP -\-? -.IP -This help message -.HP -\fB\-conf=\fR -.IP -Specify configuration file (default: komodo.conf) -.HP -\fB\-datadir=\fR -.IP -Specify data directory -.HP -\fB\-testnet\fR -.IP -Use the test network -.HP -\fB\-regtest\fR -.IP -Enter regression test mode, which uses a special chain in which blocks -can be solved instantly. This is intended for regression testing tools -and app development. -.HP -\fB\-rpcconnect=\fR -.IP -Send commands to node running on (default: 127.0.0.1) -.HP -\fB\-rpcport=\fR -.IP -Connect to JSON\-RPC on (default: 8232 or testnet: 18232) -.HP -\fB\-rpcwait\fR -.IP -Wait for RPC server to start -.HP -\fB\-rpcuser=\fR -.IP -Username for JSON\-RPC connections -.HP -\fB\-rpcpassword=\fR -.IP -Password for JSON\-RPC connections -.HP -\fB\-rpcclienttimeout=\fR -.IP -Timeout in seconds during HTTP requests, or 0 for no timeout. (default: -900) -.HP -\fB\-stdin\fR -.IP -Read extra arguments from standard input, one per line until EOF/Ctrl\-D -(recommended for sensitive information such as passphrases) -.SH COPYRIGHT - -In order to ensure you are adequately protecting your privacy when using Hush, -please see . - -Copyright (C) 2009-2019 The Bitcoin Core Developers -Copyright (C) 2015-2019 The Zcash Developers -Copyright (C) 2015-2019 jl777 and SuperNET developers -Copyright (C) 2018-2019 The Hush developers - -This is experimental software!!! - -Distributed under the MIT software license, see the accompanying file COPYING -or . - -This product includes software developed by the OpenSSL Project for use in the -OpenSSL Toolkit and cryptographic software written -by Eric Young. diff --git a/doc/man/komodo-tx.1 b/doc/man/komodo-tx.1 deleted file mode 100644 index 511ce5158..000000000 --- a/doc/man/komodo-tx.1 +++ /dev/null @@ -1,103 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10. -.TH KOMODO-TX "1" "December 2019" "komodo-tx v3.3.0" "User Commands" -.SH NAME -komodo-tx \- manual page for komodo-tx v3.3.0 -.SH DESCRIPTION -Hush komodo\-tx utility version v3.3.0\-bde7744d9 -.SS "Usage:" -.TP -komodo\-tx [options] [commands] -Update hex\-encoded zcash transaction -.TP -komodo\-tx [options] \fB\-create\fR [commands] -Create hex\-encoded zcash transaction -.SH OPTIONS -.HP -\-? -.IP -This help message -.HP -\fB\-create\fR -.IP -Create new, empty TX. -.HP -\fB\-json\fR -.IP -Select JSON output -.HP -\fB\-txid\fR -.IP -Output only the hex\-encoded transaction id of the resultant transaction. -.HP -\fB\-regtest\fR -.IP -Enter regression test mode, which uses a special chain in which blocks -can be solved instantly. -.HP -\fB\-testnet\fR -.IP -Use the test network -.PP -Commands: -.IP -delin=N -.IP -Delete input N from TX -.IP -delout=N -.IP -Delete output N from TX -.IP -in=TXID:VOUT(:SEQUENCE_NUMBER) -.IP -Add input to TX -.IP -locktime=N -.IP -Set TX lock time to N -.IP -nversion=N -.IP -Set TX version to N -.IP -outaddr=VALUE:ADDRESS -.IP -Add address\-based output to TX -.IP -outscript=VALUE:SCRIPT -.IP -Add raw script output to TX -.IP -sign=HEIGHT:SIGHASH\-FLAGS -.IP -Add zero or more signatures to transaction. This command requires JSON -registers:prevtxs=JSON object, privatekeys=JSON object. See -signrawtransaction docs for format of sighash flags, JSON objects. -.PP -Register Commands: -.IP -load=NAME:FILENAME -.IP -Load JSON file FILENAME into register NAME -.IP -set=NAME:JSON\-STRING -.IP -Set register NAME to given JSON\-STRING -.SH COPYRIGHT - -In order to ensure you are adequately protecting your privacy when using Hush, -please see . - -Copyright (C) 2009-2019 The Bitcoin Core Developers -Copyright (C) 2015-2019 The Zcash Developers -Copyright (C) 2015-2019 jl777 and SuperNET developers -Copyright (C) 2018-2019 The Hush developers - -This is experimental software!!! - -Distributed under the MIT software license, see the accompanying file COPYING -or . - -This product includes software developed by the OpenSSL Project for use in the -OpenSSL Toolkit and cryptographic software written -by Eric Young. diff --git a/doc/man/komodod.1 b/doc/man/komodod.1 deleted file mode 100644 index 9f7c9b6f1..000000000 --- a/doc/man/komodod.1 +++ /dev/null @@ -1,637 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10. -.TH KOMODOD "1" "December 2019" "komodod v3.3.0" "User Commands" -.SH NAME -komodod \- manual page for komodod v3.3.0 -.SH DESCRIPTION -Hush Daemon version v3.3.0\-bde7744d9 -.PP -In order to ensure you are adequately protecting your privacy when using Hush, -please see . -.SS "Usage:" -.TP -komodod [options] -Start Hush\-flavored Komodo Daemon -.SH OPTIONS -.HP -\-? -.IP -This help message -.HP -\fB\-alerts\fR -.IP -Receive and display P2P network alerts (default: 1) -.HP -\fB\-alertnotify=\fR -.IP -Execute command when a relevant alert is received or we see a really -long fork (%s in cmd is replaced by message) -.HP -\fB\-blocknotify=\fR -.IP -Execute command when the best block changes (%s in cmd is replaced by -block hash) -.HP -\fB\-checkblocks=\fR -.IP -How many blocks to check at startup (default: 288, 0 = all) -.HP -\fB\-checklevel=\fR -.IP -How thorough the block verification of \fB\-checkblocks\fR is (0\-4, default: 3) -.HP -\fB\-clientname=\fR -.IP -Full node client name, default 'MagicBean' -.HP -\fB\-conf=\fR -.IP -Specify configuration file (default: komodo.conf) -.HP -\fB\-daemon\fR -.IP -Run in the background as a daemon and accept commands -.HP -\fB\-datadir=\fR -.IP -Specify data directory -.HP -\fB\-exportdir=\fR -.IP -Specify directory to be used when exporting data -.HP -\fB\-dbcache=\fR -.IP -Set database cache size in megabytes (4 to 16384, default: 450) -.HP -\fB\-loadblock=\fR -.IP -Imports blocks from external blk000??.dat file on startup -.HP -\fB\-maxorphantx=\fR -.IP -Keep at most unconnectable transactions in memory (default: 100) -.HP -\fB\-mempooltxinputlimit=\fR -.IP -[DEPRECATED FROM OVERWINTER] Set the maximum number of transparent -inputs in a transaction that the mempool will accept (default: 0 = no -limit applied) -.HP -\fB\-par=\fR -.IP -Set the number of script verification threads (\fB\-8\fR to 16, 0 = auto, <0 = -leave that many cores free, default: 0) -.HP -\fB\-pid=\fR -.IP -Specify pid file (default: komodod.pid) -.HP -\fB\-prune=\fR -.IP -Reduce storage requirements by pruning (deleting) old blocks. This mode -disables wallet support and is incompatible with \fB\-txindex\fR. Warning: -Reverting this setting requires re\-downloading the entire blockchain. -(default: 0 = disable pruning blocks, >550 = target size in MiB to use -for block files) -.HP -\fB\-reindex\fR -.IP -Rebuild block chain index from current blk000??.dat files on startup -.HP -\fB\-sysperms\fR -.IP -Create new files with system default permissions, instead of umask 077 -(only effective with disabled wallet functionality) -.HP -\fB\-txindex\fR -.IP -Maintain a full transaction index, used by the getrawtransaction rpc -call (default: 0) -.HP -\fB\-addressindex\fR -.IP -Maintain a full address index, used to query for the balance, txids and -unspent outputs for addresses (default: 0) -.HP -\fB\-timestampindex\fR -.IP -Maintain a timestamp index for block hashes, used to query blocks hashes -by a range of timestamps (default: 0) -.HP -\fB\-spentindex\fR -.IP -Maintain a full spent index, used to query the spending txid and input -index for an outpoint (default: 0) -.HP -\fB\-zindex\fR -.IP -Maintain extra statistics about shielded transactions and payments -(default: 0) -.PP -Connection options: -.HP -\fB\-addnode=\fR -.IP -Add a node to connect to and attempt to keep the connection open -.HP -\fB\-banscore=\fR -.IP -Threshold for disconnecting misbehaving peers (default: 100) -.HP -\fB\-bantime=\fR -.IP -Number of seconds to keep misbehaving peers from reconnecting (default: -86400) -.HP -\fB\-bind=\fR -.IP -Bind to given address and always listen on it. Use [host]:port notation -for IPv6 -.HP -\fB\-connect=\fR -.IP -Connect only to the specified node(s) -.HP -\fB\-discover\fR -.IP -Discover own IP addresses (default: 1 when listening and no \fB\-externalip\fR -or \fB\-proxy\fR) -.HP -\fB\-dns\fR -.IP -Allow DNS lookups for \fB\-addnode\fR, \fB\-seednode\fR and \fB\-connect\fR (default: 1) -.HP -\fB\-dnsseed\fR -.IP -Query for peer addresses via DNS lookup, if low on addresses (default: 1 -unless \fB\-connect\fR) -.HP -\fB\-externalip=\fR -.IP -Specify your own public address -.HP -\fB\-forcednsseed\fR -.IP -Always query for peer addresses via DNS lookup (default: 0) -.HP -\fB\-listen\fR -.IP -Accept connections from outside (default: 1 if no \fB\-proxy\fR or \fB\-connect\fR) -.HP -\fB\-listenonion\fR -.IP -Automatically create Tor hidden service (default: 1) -.HP -\fB\-maxconnections=\fR -.IP -Maintain at most connections to peers (default: 384) -.HP -\fB\-maxreceivebuffer=\fR -.IP -Maximum per\-connection receive buffer, *1000 bytes (default: 5000) -.HP -\fB\-maxsendbuffer=\fR -.IP -Maximum per\-connection send buffer, *1000 bytes (default: 1000) -.HP -\fB\-onion=\fR -.IP -Use separate SOCKS5 proxy to reach peers via Tor hidden services -(default: \fB\-proxy\fR) -.HP -\fB\-onlynet=\fR -.IP -Only connect to nodes in network (ipv4, ipv6 or onion) -.HP -\fB\-permitbaremultisig\fR -.IP -Relay non\-P2SH multisig (default: 1) -.HP -\fB\-peerbloomfilters\fR -.IP -Support filtering of blocks and transaction with Bloom filters (default: -1) -.HP -\fB\-port=\fR -.IP -Listen for connections on (default: 7770 or testnet: 17770) -.HP -\fB\-proxy=\fR -.IP -Connect through SOCKS5 proxy -.HP -\fB\-proxyrandomize\fR -.IP -Randomize credentials for every proxy connection. This enables Tor -stream isolation (default: 1) -.HP -\fB\-seednode=\fR -.IP -Connect to a node to retrieve peer addresses, and disconnect -.HP -\fB\-timeout=\fR -.IP -Specify connection timeout in milliseconds (minimum: 1, default: 5000) -.HP -\fB\-torcontrol=\fR: -.IP -Tor control port to use if onion listening enabled (default: -127.0.0.1:9051) -.HP -\fB\-torpassword=\fR -.IP -Tor control port password (default: empty) -.HP -\fB\-whitebind=\fR -.IP -Bind to given address and whitelist peers connecting to it. Use -[host]:port notation for IPv6 -.HP -\fB\-whitelist=\fR -.IP -Whitelist peers connecting from the given netmask or IP address. Can be -specified multiple times. Whitelisted peers cannot be DoS banned and -their transactions are always relayed, even if they are already in the -mempool, useful e.g. for a gateway -.PP -Wallet options: -.HP -\fB\-disablewallet\fR -.IP -Do not load the wallet and disable wallet RPC calls -.HP -\fB\-keypool=\fR -.IP -Set key pool size to (default: 100) -.HP -\fB\-paytxfee=\fR -.IP -Fee (in KMD/kB) to add to transactions you send (default: 0.00) -.HP -\fB\-rescan\fR -.IP -Rescan the block chain for missing wallet transactions on startup -.HP -\fB\-salvagewallet\fR -.IP -Attempt to recover private keys from a corrupt wallet.dat on startup -.HP -\fB\-sendfreetransactions\fR -.IP -Send transactions as zero\-fee transactions if possible (default: 0) -.HP -\fB\-spendzeroconfchange\fR -.IP -Spend unconfirmed change when sending transactions (default: 1) -.HP -\fB\-txconfirmtarget=\fR -.IP -If paytxfee is not set, include enough fee so transactions begin -confirmation on average within n blocks (default: 2) -.HP -\fB\-txexpirydelta\fR -.IP -Set the number of blocks after which a transaction that has not been -mined will become invalid (default: 200) -.HP -\fB\-maxtxfee=\fR -.IP -Maximum total fees (in KMD) to use in a single wallet transaction; -setting this too low may abort large transactions (default: 0.10) -.HP -\fB\-upgradewallet\fR -.IP -Upgrade wallet to latest format on startup -.HP -\fB\-wallet=\fR -.IP -Specify wallet file (within data directory) (default: wallet.dat) -.HP -\fB\-walletbroadcast\fR -.IP -Make the wallet broadcast transactions (default: 1) -.HP -\fB\-walletnotify=\fR -.IP -Execute command when a wallet transaction changes (%s in cmd is replaced -by TxID) -.HP -\fB\-whitelistaddress=\fR -.IP -Enable the wallet filter for notary nodes and add one Raddress to the -whitelist of the wallet filter. If \fB\-whitelistaddress=\fR is used, then the -wallet filter is automatically activated. Several Raddresses can be -defined using several \fB\-whitelistaddress=\fR (similar to \fB\-addnode\fR). The -wallet filter will filter the utxo to only ones coming from my own -Raddress (derived from pubkey) and each Raddress defined using -\fB\-whitelistaddress=\fR this option is mostly for Notary Nodes). -.HP -\fB\-zapwallettxes=\fR -.IP -Delete all wallet transactions and only recover those parts of the -blockchain through \fB\-rescan\fR on startup (1 = keep tx meta data e.g. -account owner and payment request information, 2 = drop tx meta data) -.PP -ZeroMQ notification options: -.HP -\fB\-zmqpubhashblock=\fR
-.IP -Enable publish hash block in
-.HP -\fB\-zmqpubhashtx=\fR
-.IP -Enable publish hash transaction in
-.HP -\fB\-zmqpubrawblock=\fR
-.IP -Enable publish raw block in
-.HP -\fB\-zmqpubrawtx=\fR
-.IP -Enable publish raw transaction in
-.PP -Debugging/Testing options: -.HP -\fB\-debug=\fR -.IP -Output debugging information (default: 0, supplying is -optional). If is not supplied or if = 1, output -all debugging information. can be: addrman, alert, bench, -coindb, db, estimatefee, http, libevent, lock, mempool, net, -partitioncheck, pow, proxy, prune, rand, reindex, rpc, selectcoins, tor, -zmq, zrpc, zrpcunsafe (implies zrpc). -.HP -\fB\-experimentalfeatures\fR -.IP -Enable use of experimental features -.HP -\fB\-help\-debug\fR -.IP -Show all debugging options (usage: \fB\-\-help\fR \fB\-help\-debug\fR) -.HP -\fB\-logips\fR -.IP -Include IP addresses in debug output (default: 0) -.HP -\fB\-logtimestamps\fR -.IP -Prepend debug output with timestamp (default: 1) -.HP -\fB\-minrelaytxfee=\fR -.IP -Fees (in KMD/kB) smaller than this are considered zero fee for relaying -(default: 0.000001) -.HP -\fB\-printtoconsole\fR -.IP -Send trace/debug info to console instead of debug.log file -.HP -\fB\-shrinkdebugfile\fR -.IP -Shrink debug.log file on client startup (default: 1 when no \fB\-debug\fR) -.HP -\fB\-testnet\fR -.IP -Use the test network -.PP -Node relay options: -.HP -\fB\-datacarrier\fR -.IP -Relay and mine data carrier transactions (default: 1) -.HP -\fB\-datacarriersize\fR -.IP -Maximum size of data in data carrier transactions we relay and mine -(default: 8192) -.PP -Block creation options: -.HP -\fB\-blockminsize=\fR -.IP -Set minimum block size in bytes (default: 0) -.HP -\fB\-blockmaxsize=\fR -.IP -Set maximum block size in bytes (default: 2000000) -.HP -\fB\-blockprioritysize=\fR -.IP -Set maximum size of high\-priority/low\-fee transactions in bytes -(default: 1000000) -.PP -Mining options: -.HP -\fB\-mint\fR -.IP -Mint/stake coins automatically (default: 0) -.HP -\fB\-gen\fR -.IP -Mine/generate coins (default: 0) -.HP -\fB\-genproclimit=\fR -.IP -Set the number of threads for coin mining if enabled (\fB\-1\fR = all cores, -default: 0) -.HP -\fB\-equihashsolver=\fR -.IP -Specify the Equihash solver to be used if enabled (default: "default") -.HP -\fB\-mineraddress=\fR -.IP -Send mined coins to a specific single address -.HP -\fB\-minetolocalwallet\fR -.IP -Require that mined blocks use a coinbase address in the local wallet -(default: 1) -.PP -RPC server options: -.HP -\fB\-server\fR -.IP -Accept command line and JSON\-RPC commands -.HP -\fB\-rest\fR -.IP -Accept public REST requests (default: 0) -.HP -\fB\-rpcbind=\fR -.IP -Bind to given address to listen for JSON\-RPC connections. Use -[host]:port notation for IPv6. This option can be specified multiple -times (default: bind to all interfaces) -.HP -\fB\-rpcuser=\fR -.IP -Username for JSON\-RPC connections -.HP -\fB\-rpcpassword=\fR -.IP -Password for JSON\-RPC connections -.HP -\fB\-rpcport=\fR -.IP -Listen for JSON\-RPC connections on (default: 7771 or testnet: -17771) -.HP -\fB\-rpcallowip=\fR -.IP -Allow JSON\-RPC connections from specified source. Valid for are a -single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) -or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified -multiple times -.HP -\fB\-rpcthreads=\fR -.IP -Set the number of threads to service RPC calls (default: 4) -.PP -Metrics Options (only if \fB\-daemon\fR and \fB\-printtoconsole\fR are not set): -.HP -\fB\-showmetrics\fR -.IP -Show metrics on stdout (default: 1 if running in a console, 0 otherwise) -.HP -\fB\-metricsui\fR -.IP -Set to 1 for a persistent metrics screen, 0 for sequential metrics -output (default: 1 if running in a console, 0 otherwise) -.HP -\fB\-metricsrefreshtime\fR -.IP -Number of seconds between metrics refreshes (default: 1 if running in a -console, 600 otherwise) -.PP -Komodo Asset Chain options: -.HP -\fB\-ac_algo\fR -.IP -Choose PoW mining algorithm, default is Equihash -.HP -\fB\-ac_blocktime\fR -.IP -Block time in seconds, default is 60 -.HP -\fB\-ac_cc\fR -.IP -Cryptoconditions, default 0 -.HP -\fB\-ac_beam\fR -.IP -BEAM integration -.HP -\fB\-ac_coda\fR -.IP -CODA integration -.HP -\fB\-ac_cclib\fR -.IP -Cryptoconditions dynamicly loadable library -.HP -\fB\-ac_ccenable\fR -.IP -Cryptoconditions to enable -.HP -\fB\-ac_ccactivate\fR -.IP -Block height to enable Cryptoconditions -.HP -\fB\-ac_decay\fR -.IP -Percentage of block reward decrease at each halving -.HP -\fB\-ac_end\fR -.IP -Block height at which block rewards will end -.HP -\fB\-ac_eras\fR -.IP -Block reward eras -.HP -\fB\-ac_founders\fR -.IP -Number of blocks between founders reward payouts -.HP -\fB\-ac_halving\fR -.IP -Number of blocks between each block reward halving -.HP -\fB\-ac_name\fR -.IP -Name of asset chain -.HP -\fB\-ac_notarypay\fR -.IP -Pay notaries, default 0 -.HP -\fB\-ac_perc\fR -.IP -Percentage of block rewards paid to the founder -.HP -\fB\-ac_private\fR -.IP -Shielded transactions only (except coinbase + notaries), default is 0 -.HP -\fB\-ac_pubkey\fR -.IP -Public key for receiving payments on the network -.HP -\fB\-ac_public\fR -.IP -Transparent transactions only, default 0 -.HP -\fB\-ac_reward\fR -.IP -Block reward in satoshis, default is 0 -.HP -\fB\-ac_sapling\fR -.IP -Sapling activation block height -.HP -\fB\-ac_script\fR -.IP -P2SH/multisig address to receive founders rewards -.HP -\fB\-ac_staked\fR -.IP -Percentage of blocks that are Proof\-Of\-Stake, default 0 -.HP -\fB\-ac_supply\fR -.IP -Starting supply, default is 0 -.HP -\fB\-ac_timelockfrom\fR -.IP -Timelocked coinbase start height -.HP -\fB\-ac_timelockgte\fR -.IP -Timelocked coinbase minimum amount to be locked -.HP -\fB\-ac_timelockto\fR -.IP -Timelocked coinbase stop height -.HP -\fB\-ac_txpow\fR -.IP -Enforce transaction\-rate limit, default 0 -.SH COPYRIGHT - -In order to ensure you are adequately protecting your privacy when using Hush, -please see . - -Copyright (C) 2009-2019 The Bitcoin Core Developers -Copyright (C) 2015-2019 The Zcash Developers -Copyright (C) 2015-2019 jl777 and SuperNET developers -Copyright (C) 2018-2019 The Hush developers - -This is experimental software!!! - -Distributed under the MIT software license, see the accompanying file COPYING -or . - -This product includes software developed by the OpenSSL Project for use in the -OpenSSL Toolkit and cryptographic software written -by Eric Young. From ff1c90ffc8c140b2d308612926766e70f4cd8962 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 23:04:38 -0400 Subject: [PATCH 12/16] update docs --- doc/wallet-backup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/wallet-backup.md b/doc/wallet-backup.md index b229211ab..e1173f0da 100644 --- a/doc/wallet-backup.md +++ b/doc/wallet-backup.md @@ -16,7 +16,7 @@ These instructions are specific for the officially supported Hush Linux client. There are multiple ways to make sure you have at least one other copy of the private keys needed to spend your HUSH and view your shielded HUSH. -For all methods, you will need to include an export directory setting in your config file (`HUSH3.conf` located in the data directory which is `~/.komodo/HUSH3` unless it's been overridden with `datadir=` setting): +For all methods, you will need to include an export directory setting in your config file (`HUSH3.conf` located in the data directory which is `~/.hush/HUSH3` or `~/.komodo/HUSH3` (Legacy Location) unless it's been overridden with `datadir=` setting): `exportdir=path/to/chosen/export/directory` From 7e8b8795be5eb1a1c902f439c67ececad330e9cc Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 23:13:44 -0400 Subject: [PATCH 13/16] Update protocol version --- src/clientversion.cpp | 2 +- src/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index dd52311bb..5702fbb95 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -32,7 +32,7 @@ * for both bitcoind and bitcoin-core, to make it harder for attackers to * target servers or GUI users specifically. */ -const std::string CLIENT_NAME = GetArg("-clientname", "jl777sRemorse"); +const std::string CLIENT_NAME = GetArg("-clientname", "GoldenSandtrout"); /** * Client version number diff --git a/src/version.h b/src/version.h index 3c8f28347..a08199ef3 100644 --- a/src/version.h +++ b/src/version.h @@ -21,7 +21,7 @@ #define HUSH_VERSION_H // network protocol versioning -static const int PROTOCOL_VERSION = 1987423; +static const int PROTOCOL_VERSION = 1987424; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; //! In this version, 'getheaders' was introduced. From 2c2684374340c5a0512d8f8f60f39e3fb7d10402 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 16 Sep 2021 23:19:28 -0400 Subject: [PATCH 14/16] More dev notes --- doc/developer-notes.md | 7 ++++--- src/sync.cpp | 3 --- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 2f8d7bfdf..3e5c42cfc 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -29,7 +29,7 @@ It's possible to confused hush if you ran old code, stop, restart, and then writ * Update version in configure.ac and src/clientversion.h * Run ./contrib/devtools/gen-manpages.sh, commit + push results * Update checkpoints - * Update protocol version if necessary + * Update protocol version in src/version.h if necessary * Make Gitea release * Make Git Tag (Gitea can do this) @@ -146,8 +146,9 @@ on all categories (and give you a very large debug.log file). **testnet and regtest modes** -Run with the -testnet option to run with "play zcash" on the test network, if you -are testing multi-machine code that needs to operate across the internet. +Run with the -testnet option to run with "play HUSH" on the test network, if you +are testing multi-machine code that needs to operate across the internet. You can +also make a Hush Smart Chain "testcoin" with a single command: `hushd -ac_name=COIN ...` If you are testing something that can run on one machine, run with the -regtest option. In regression test mode, blocks can be created on-demand; see qa/rpc-tests/ for tests diff --git a/src/sync.cpp b/src/sync.cpp index 6b8fd38f9..209dd9edb 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -19,12 +19,9 @@ ******************************************************************************/ #include "sync.h" - #include "util.h" #include "utilstrencodings.h" - #include - #include #include From e00dabb79b1afdad3f1180342dbc65183625069d Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 18 Sep 2021 11:25:13 -0400 Subject: [PATCH 15/16] Fix bug in listaddresses RPC --- src/wallet/rpcwallet.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index c2a8484e0..76f160968 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -443,8 +443,6 @@ UniValue listaddresses(const UniValue& params, bool fHelp, const CPubKey& mypk) LOCK2(cs_main, pwalletMain->cs_wallet); - string strAccount = AccountFromValue(params[0]); - // Find all taddrs UniValue ret(UniValue::VARR); for (const std::pair& item : pwalletMain->mapAddressBook) { From 63e29ac20af76bd4e8dbfe624a8a9c642e07a105 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 18 Sep 2021 11:25:59 -0400 Subject: [PATCH 16/16] TUSH gonna TUSH --- src/tushd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tushd b/src/tushd index ad5fafa21..9089ffe8c 100755 --- a/src/tushd +++ b/src/tushd @@ -10,5 +10,6 @@ cd $DIR DIR="$( cd "$( dirname "$( readlink "${BASH_SOURCE[0]}" )" )" && pwd )" cd $DIR -./hushd -ac_name=TUSH -ac_private=1 -gen=1 -testnode=1 +# ./hushd -ac_name=TUSH -ac_private=1 -gen=1 -testnode=1 +./hushd -ac_name=TUSH -ac_private=1 -ac_supply=55555