-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added transaction categories for beacon and voting #973
Conversation
We use 4 spaces not tabs if (currentcondition == statecondition) if (a == b) void dummyfunction() Like the idea so please clean it up cheers 1234 is the spacing since i havent had my coffee yet and forgot the code block |
src/qt/transactionrecord.cpp
Outdated
@@ -163,8 +164,31 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * | |||
if (ExtractDestination(txout.scriptPubKey, address)) | |||
{ | |||
// Sent to Bitcoin Address | |||
sub.type = TransactionRecord::SendToAddress; | |||
sub.address = CBitcoinAddress(address).ToString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Sent to testnet or mainnet vote / beacon address
if (sub.address == GetBurnAddress())
{
std::vector<std::pair<std::string, std::string>> vTxNormalInfoIn = GetTxNormalBoincHashInfo(wtx);
for (const auto& vTxNormalInfo : vTxNormalInfoIn)
{
if (vTxNormalInfo.first == "Message Type")
{
if (vTxNormalInfo.second == "Vote" || vTxNormalInfo.second == "Add Poll")
{
if (fDebug)
OutputDebugStringF("Vote/Add Poll\n");
sub.type = TransactionRecord::Vote;
break;
}
else if (vTxNormalInfo.second == "Add Beacon Contract")
{
sub.type = TransactionRecord::Beacon;
break;
}
/* Message icon example as well
else if (vTxNormalInfo.second == "Text Message")
{
sub.type TransactionRecord::Message;
break;
}
*/
// Message type is not one we are checking for. end the for auto loop
else
break;
}
}
}
}
that is likely better @denravonska may chime in that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Message icon part is if u add a message icon change as i asked
src/qt/transactionrecord.cpp
Outdated
@@ -2,13 +2,14 @@ | |||
#include "wallet.h" | |||
#include "base58.h" | |||
|
|||
std::vector<std::pair<std::string, std::string>> GetTxNormalBoincHashInfo(const CMerkleTx& mtx); | |||
std::string GetTxProject(uint256 hash, int& out_blocknumber, int& out_blocktype, double& out_rac); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if u use the suggested code block below add here
std::string GetBurnAddress();
I do not remember you @Pythonix. Please do not take the white-space criticism personally. It is a minor thing. Either fix it or say you won't. |
I don't take it personally. I'm glade for the help @Foggyx420 offered me and I'm happy to change my code. |
I wasn't criticizing at all. N I did help him get it going. |
@Pythonix @tomasbrod Don't just say you won't do it unless you can argue why, other than lazyness. I have a 3-year old who does that and it's super annoying. |
added categories for send/receive message and send/receive rain
@denravonska travis fails to find the icon file idk if it has not pulled it from the pr or its just a travis issue. I successfully compiled his branch for that icon locally linux 64 |
The .svg file needs to be added to the RES_ICONS file list in Makefile.qt.include. This should fix the travis issue. |
There is still one error: The SendMessage enum seems to conflict with a macro when compiling with mingw32. Either add
To transactionrecord.h and .cpp and transactiontablemodel.cpp , or rename the SendMessage enum to something that does not conflict. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have a look how this could be improved.
typeWidget->addItem(tr("Vote"), TransactionFilterProxy::TYPE(TransactionRecord::Vote)); | ||
typeWidget->addItem(tr("Beacon"), TransactionFilterProxy::TYPE(TransactionRecord::Beacon)); | ||
typeWidget->addItem(tr("Sent message"), TransactionFilterProxy::TYPE(TransactionRecord::SendMessage)); | ||
typeWidget->addItem(tr("Received message"), TransactionFilterProxy::TYPE(TransactionRecord::RecvMessage)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the transaction is "To yourself" "Sent message" and "Received message" at the same time?
std::vector<std::pair<std::string, std::string>> vTxNormalInfoIn = GetTxNormalBoincHashInfo(wtx); | ||
for (const auto& vTxNormalInfo : vTxNormalInfoIn) | ||
{ | ||
if (vTxNormalInfo.first == "Message Type") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably fail when localized.
SendToSelf, | ||
Vote, | ||
Beacon, | ||
SendMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Macros are evil in c++. I suggest the #undef option.
Anything left to be done with this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Tomas is right. The vTxNormalInfo stuff... "Message Type" is not safe under localization. We need to rethink this...
@iFoggz There are a lot of changes that were made to transactionrecord.cpp for sidestaking that are going to make the merge resolution very tricky. |
Localization as in language of the client user? The data stored in the blocks for messages, etc is unaffected by the translations as those are done at compile for what we have slated to have available translations. Example the boincHash stuff always in english. I cannot tie anything here that suggests translation macros would affect our core code or block boincHash format. If anyone has any ideas of this please let me know. as for merge conflicts since other areas have been done it will be better to redo this ontop of current code base to make this more clean and more fitting into existing changes. |
I concur with all your comments.
…Sent from my iPhone
On Aug 24, 2019, at 6:33 PM, Paul Jensen ***@***.***> wrote:
Localization as in language of the client user?
The data stored in the blocks for messages, etc is unaffected by the translations as those are done at compile for what we have slated to have available translations.
Example the boincHash stuff always in english.
If a chinese user sends a chinese message to a user they receive the message in chinese however the boincHash is still the way it is coded.
vTxNormalInfo is always in same format regardless of localization. if it wasn't we would have to compensate for every localization
I cannot tie anything here that suggests translation macros would affect our core code or block boincHash format.
If anyone has any ideas of this please let me know.
as for merge conflicts since other areas have been done it will be better to redo this ontop of current code base to make this more clean and more fitting into existing changes.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
So we have confirmed that localization is not an issue here. We have a lot of conflicts in transactionrecord.cpp because this was extensively modified for sidestaking. Given that, ifoggz is going to redo this on top of the head of development and put up another PR to control the regression risk. I concur with that strategy. We will leave this open until the new PR is up. |
This implementation uses Gridcoin-Research/src/rpcrawtransaction.cpp Line 116 in ddaaf8d
As it is written here, we'll get the desired behavior de facto because none of the translation units contain a valid substitution for those identifiers yet. If someone adds localization for those in a language besides English, the categorization will break when the wallet is configured to use that language:
To avoid the localization issue, we need to remove the localization from |
The issue with doing your second option is that it is not backwards facing, whereas playing games with the messages is a UI model only thing that is entirely local on the node. Bad set of choices IMHO. |
@jamescowens Sorry for being unclear--I'm not suggesting any changes to the protocol. The second solution that I proposed should just do what the wallet already does here but in a way that doesn't rely on localized strings. The |
@iFoggz ^ See @cyrossignol's comments. |
this should be redone on latest commits.and |
I have added two new transaction categories. One for voting and one for sending the beacon.
The category for sending the Beacon does not yet have its own icon.
This would close #389