From 13458b404042e2a2a6865fae70c999e70d06f28c Mon Sep 17 00:00:00 2001 From: ca333 Date: Thu, 18 Apr 2019 23:15:48 +0200 Subject: [PATCH 1/5] [add] KOIN --- src/ac/koin | 2 ++ src/assetchains.json | 11 ++++++++--- src/assetchains.old | 1 + src/fiat/koin | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100755 src/ac/koin create mode 100755 src/fiat/koin diff --git a/src/ac/koin b/src/ac/koin new file mode 100755 index 000000000..7e76c6b54 --- /dev/null +++ b/src/ac/koin @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=KOIN $1 $2 $3 $4 $5 $6 diff --git a/src/assetchains.json b/src/assetchains.json index 87173697b..99c6557b6 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -237,8 +237,8 @@ "217.182.129.38", "37.187.225.231" ] - }, - { + }, + { "ac_name": "ILN", "ac_supply": "10000000000", "ac_cc": "2", @@ -258,10 +258,15 @@ "ac_cc": "3", "addnode": ["138.201.136.145"] }, -{ + { "ac_name": "VOTE2019", "ac_supply": "123651638", "ac_public": "1", "addnode": ["95.213.238.98"] + }, + { + "ac_name": "KOIN", + "ac_supply": "125000000", + "addnode": ["3.0.32.10"] } ] diff --git a/src/assetchains.old b/src/assetchains.old index 8f0d763b5..a0cbd3b9c 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -50,3 +50,4 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=RICK -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -addnode=138.201.136.145 & ./komodod -pubkey=$pubkey -ac_name=MORTY -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -addnode=138.201.136.145 & ./komodod -pubkey=$pubkey -ac_name=VOTE2019 -ac_supply=123651638 -ac_public=1 -addnode=95.213.238.98 & +./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 & diff --git a/src/fiat/koin b/src/fiat/koin new file mode 100755 index 000000000..7e76c6b54 --- /dev/null +++ b/src/fiat/koin @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=KOIN $1 $2 $3 $4 $5 $6 From a19e28371513589fdc4b1f6195a775922af73d34 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 27 Apr 2019 17:48:06 +0800 Subject: [PATCH 2/5] add dpow to BEER, fix crashed node not being able to sync due to future checkpoints. --- src/komodo.h | 2 +- src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 15c1e5c02..b4c7d12bf 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -621,7 +621,7 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar memset(&MoMoMdata,0,sizeof(MoMoMdata)); if ( matched == 0 && signedmask != 0 && bitweight(signedmask) >= KOMODO_MINRATIFY ) notarized = 1; - if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("TXSCL",ccdata.symbol,5) == 0 ) + if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("TXSCL",ccdata.symbol,5) == 0 || strcmp("BEER",ccdata.symbol) == 0) notarized = 1; if ( 0 && opretlen != 149 ) printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset); diff --git a/src/main.cpp b/src/main.cpp index e0e40c9a5..352bd65fb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4243,7 +4243,7 @@ static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBloc // stay on the same chain tip! int32_t notarizedht,prevMoMheight; uint256 notarizedhash,txid; notarizedht = komodo_notarized_height(&prevMoMheight,¬arizedhash,&txid); - if ( !fSkipdpow && pindexFork != 0 && pindexFork->GetHeight() < notarizedht ) + if ( !fSkipdpow && pindexFork != 0 && pindexOldTip->GetHeight() > notarizedht && pindexFork->GetHeight() < notarizedht ) { fprintf(stderr,"pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->GetHeight(),notarizedht); return state.DoS(100, error("ActivateBestChainStep(): pindexFork->GetHeight().%d is < notarizedht %d, so ignore it",(int32_t)pindexFork->GetHeight(),notarizedht), From 3110814bae5b91a30a5518f467c371d61501ca56 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 27 Apr 2019 20:36:33 +0800 Subject: [PATCH 3/5] add extr print for new fix --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 352bd65fb..45d2e7a39 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4245,8 +4245,8 @@ static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBloc notarizedht = komodo_notarized_height(&prevMoMheight,¬arizedhash,&txid); if ( !fSkipdpow && pindexFork != 0 && pindexOldTip->GetHeight() > notarizedht && pindexFork->GetHeight() < notarizedht ) { - fprintf(stderr,"pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->GetHeight(),notarizedht); - return state.DoS(100, error("ActivateBestChainStep(): pindexFork->GetHeight().%d is < notarizedht %d, so ignore it",(int32_t)pindexFork->GetHeight(),notarizedht), + fprintf(stderr,"pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->GetHeight(),notarizedht,(int32_t)pindexOldTip->GetHeight(),notarizedht); + return state.DoS(100, error("ActivateBestChainStep(): pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it",(int32_t)pindexFork->GetHeight(),notarizedht,(int32_t)pindexOldTip->GetHeight(),notarizedht), REJECT_INVALID, "past-notarized-height"); } // - On ChainDB initialization, pindexOldTip will be null, so there are no removable blocks. From cf6f647d1eb1d20a10e0f3303448c61b2d2c51ec Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 29 Apr 2019 11:25:23 +0800 Subject: [PATCH 4/5] fix wallet corruption fix, for staking chains, fix forced rescan for ZEX and KMD with ztx in wallet. --- src/wallet/walletdb.cpp | 53 +++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 5631fb79e..efba38d9e 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -485,11 +485,16 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, ssValue >> wtx; CValidationState state; auto verifier = libzcash::ProofVerifier::Strict(); - if (!(CheckTransaction(0,wtx, state, verifier) && (wtx.GetHash() == hash) && state.IsValid())) + // ac_public chains set at height like KMD and ZEX, will force a rescan if we dont ignore this error: bad-txns-acpublic-chain + // there cannot be any ztx in the wallet on ac_public chains that started from block 1, so this wont affect those. + if ( !(CheckTransaction(0,wtx, state, verifier) && (wtx.GetHash() == hash) && state.IsValid()) && (state.GetRejectReason() != "bad-txns-acpublic-chain") ) { - deadTxns.push_back(hash); + //fprintf(stderr, "tx failed: %s rejectreason.%s\n", wtx.GetHash().GetHex().c_str(), state.GetRejectReason().c_str()); + // vin-empty on staking chains is error relating to a failed staking tx, that for some unknown reason did not fully erase. save them here to erase and re-add later on. + if ( ASSETCHAINS_STAKED != 0 && state.GetRejectReason() == "bad-txns-vin-empty" ) + deadTxns.push_back(hash); return false; - } + } // Undo serialize changes in 31600 if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703) { @@ -937,6 +942,9 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) { // Leave other errors alone, if we try to fix them we might make things worse. fNoncriticalErrors = true; // ... but do warn the user there is something wrong. + // set rescan for any error that is not vin-empty on staking chains. + if ( deadTxns.empty() && strType == "tx") + SoftSetBoolArg("-rescan", true); } } if (!strErr.empty()) @@ -953,33 +961,26 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) if ( !deadTxns.empty() ) { - if ( ASSETCHAINS_STAKED != 0 ) + // staking chains with vin-empty error is a failed staking tx. + // we remove then re add the tx here to stop needing a full rescan, which does not actually fix the problem. + int32_t reAdded = 0; + CWalletDB walletdb(pwallet->strWalletFile, "r+", false); + BOOST_FOREACH (uint256& hash, deadTxns) { - int32_t reAdded = 0; - CWalletDB walletdb(pwallet->strWalletFile, "r+", false); - BOOST_FOREACH (uint256& hash, deadTxns) + fprintf(stderr, "Removing corrupt tx from wallet.%s\n", hash.ToString().c_str()); + if (!EraseTx(hash)) + fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str()); + uint256 blockhash; CTransaction tx; + if (GetTransaction(hash,tx,blockhash,true)) { - fprintf(stderr, "Removing corrupt tx from wallet.%s\n", hash.ToString().c_str()); - if (!EraseTx(hash)) - fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str()); - uint256 blockhash; CTransaction tx; - if (GetTransaction(hash,tx,blockhash,true)) - { - CWalletTx wtx(pwallet,tx); - pwallet->AddToWallet(wtx, false, &walletdb); - reAdded++; - } + CWalletTx wtx(pwallet,tx); + pwallet->AddToWallet(wtx, false, &walletdb); + reAdded++; } - fprintf(stderr, "Cleared %lu corrupted transactions from wallet. Readded %i known transactions.\n",(long)deadTxns.size(),reAdded); - fNoncriticalErrors = false; - deadTxns.clear(); - } - else if ( (GetBoolArg("-zapwallettxes", false)) ) - { - LogPrintf("Transactions are corrupted. Please restart daemon with -zapwallettxes=2\n"); - fprintf(stderr,"Transactions are corrupted. Please restart daemon with -zapwallettxes=2\n"); - return DB_CORRUPT; } + fprintf(stderr, "Cleared %li corrupted transactions from wallet. Readded %i known transactions.\n",deadTxns.size(),reAdded); + fNoncriticalErrors = false; + deadTxns.clear(); } if (fNoncriticalErrors && result == DB_LOAD_OK) From a0aaff137153810c39833d7ce8eb44a14511bf7b Mon Sep 17 00:00:00 2001 From: dimxy Date: Mon, 29 Apr 2019 12:32:41 +0500 Subject: [PATCH 5/5] fix unmarshal source symbol from rawproof --- src/rpc/rawtransaction.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index c5d2bea86..1c3cb96f2 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -217,7 +217,8 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue& { if (rawproof.size() > 0) { - std::string sourceSymbol(rawproof.begin(), rawproof.end()); + std::string sourceSymbol; + E_UNMARSHAL(rawproof, ss >> sourceSymbol); in.push_back(Pair("address", "IMP-" + sourceSymbol + "-" + burnTx.GetHash().ToString())); } }