is this working now?

This commit is contained in:
blackjok3r
2018-11-03 16:35:51 +08:00
parent c52c8d2a37
commit 4d85706859
4 changed files with 23 additions and 11 deletions

View File

@@ -4959,6 +4959,7 @@ UniValue channelsaddress(const UniValue& params, bool fHelp)
}
bool pubkey2addr(char *destaddr,uint8_t *pubkey33);
extern int32_t IS_KOMODO_NOTARY;
UniValue setpubkey(const UniValue& params, bool fHelp)
{
@@ -5005,9 +5006,20 @@ UniValue setpubkey(const UniValue& params, bool fHelp)
NOTARY_ADDRESS = address.ToString();
result.push_back(Pair("address", NOTARY_ADDRESS));
#ifdef ENABLE_WALLET
isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO;
result.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false));
isminetype mine = pwalletMain;
if ( IsMine(*pwalletMain, dest) == ISMINE_NO ) {
result.push_back(Pair("WARNING", "privkey for this pubkey is not imported to wallet!"));
} else {
result.push_back(Pair("ismine", "true"));
std::string notaryname;
if ( StakedNotaryID(notaryname, Raddress) != -1 ) {
IS_KOMODO_NOTARY = 1;
result.push_back(Pair("IsNotary", notaryname));
}
}
#endif
} else {
result.push_back(Pair("error", "pubkey entered is invalid."));
}
NOTARY_PUBKEY = params[0].get_str();
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());

View File

@@ -1213,7 +1213,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0)
{
if ( NOTARY_ADDRESS != "" )
if ( NOTARY_ADDRESS != "" && IS_KOMODO_NOTARY == 1 )
{
int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0;
for (size_t i = 0; i < tx.vin.size(); i++) {
@@ -1252,7 +1252,9 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
} else if ( numvinIsOurs < tx.vin.size() ) {
// this means we were in a multi sig, we wil remove the utxo we spent from our wallet,
// IF there exisited a function for that.
// IF there exisited a function for that.
// Maybe check if there are any vouts unspetn in this TX
// then purge the TX from wallet if all spent?
fprintf(stderr, "There are vins that are not ours, notarisation?\n");
}
}