-
Notifications
You must be signed in to change notification settings - Fork 37.1k
[Qt] add verifySize() function to PaymentServer #5665
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
Conversation
I would also strongly recommend to add a Unit-Test for |
@jonasschnelli As |
@Diapolo IMO we should add the 50001 bytes test. You might use this forged payment request http://jonasschnelli.ch/r1422608371.bitcoinpaymentrequest I also tried to test |
@jonasschnelli I'm fine with directly using What do you mean by |
@Diapolo: sounds even better. I would recommend to just pass 50001 bytes through |
@jonasschnelli Updated, I hope this is fine now? |
tested ACK |
Anything left to do for me to get this and other related pulls merged ;)? |
Ping |
@laanwj Mind giving this the final ACK ;)? |
ReACK |
@laanwj ping |
@@ -185,7 +185,8 @@ void PaymentServerTests::paymentServerTests() | |||
tempFile.open(); | |||
tempFile.write((const char*)randData, sizeof(randData)); | |||
tempFile.close(); | |||
QCOMPARE(PaymentServer::readPaymentRequestFromFile(tempFile.fileName(), r.paymentRequest), false); |
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.
Why are you removing this test?
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.
To be able to make readPaymentRequestFromFile
private again, which I changed once and wasn't happy with it :). The function could also fail, if the file failed to open, which isn't what this test is for anyway.
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 you want to be able to test a private methods you could use a friend class / function. E.g. inside the class do
friend class PaymentServerTester;
Then do the testing in a class PaymentServerTester.
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.
@laanwj It's not necessary here, but thanks for that C++ lesson :).
@jonasschnelli Maybe you can help me understand what's preventing this pull from getting merged? |
@laanwj @jonasschnelli Ping |
@Diapolo because you removed the test for, unrelated, PaymentServer::readPaymentRequestFromFile |
@laanwj As I said, I just made |
ut ACK |
@laanwj Fixed merge-conflict, ready now. |
- add static verifySize() function to PaymentServer and move the logging on error into the function - also use the new function in the unit test - the function checks if the size is allowed as per BIP70
@laanwj Ping |
Final ping! |
on error into the function