Payment request parsing of network names is now strict (does not assume testnet if not main).
Enforce strict parsing of network names in payment request processing #4275
pull rnicoll wants to merge 1 commits into bitcoin:master from rnicoll:master-payment changing 1 files +5 −1-
rnicoll commented at 9:17 PM on June 2, 2014: contributor
-
laanwj commented at 6:48 AM on June 3, 2014: member
Wasn't it failing later on anyway, when it gets to the real processing? At least that'd allow popping up an error.
Ideally ipcParseCommandLine shouldn't signal errors, as you noticed they can't be displayed to the user.
-
Diapolo commented at 7:13 AM on June 3, 2014: none
I'm also sure the error is catched later with user visible feedback about what happened. Anyway, I still think we should try to send (via
ipcCommandLine()) first to a mainnet instance and if that fails to a testnet instance and remove that whole "try to get or guess the right network" stuff inipcParseCommandLine()alltogether as it complicates things. Who in real world (normal user) has a testnet AND mainnet instance running?Edit: See #4278 for a pull.
-
rnicoll commented at 7:27 AM on June 3, 2014: contributor
I think you're right, it's adding too much error handling at the wrong point, in retrospect. Won't have time to write a new patch until tonight, but how about it switches the client to testnet if it detects a testnet payment request, and otherwise has no interaction with the network field? Thinking more about this, I think it's preferable that a mainnet payment request fails if the client is launched on testnet, than the client is switched over to mainnet.
-
laanwj commented at 12:53 PM on June 3, 2014: member
@Diapolo I don't agree. It should be possible to run both a testnet and mainnet instance at the same time and have URIs and payment requests arrive at the right instance. @rnicoll The idea is to override the user-provided network (provided on the command line or configuration file) with the network of the payment request. This could happen in both directions.
-
rnicoll commented at 6:55 PM on June 3, 2014: contributor
Reworked to defer validation until GUI is up, and also to tighten checks in the GUI so a nonsense network name is never accepted (also avoids any potential issues with other coins using unsupported network names and file mixups)
-
laanwj commented at 7:14 AM on June 4, 2014: member
Untested ACK
-
in src/qt/paymentserver.cpp:None in b772a43261 outdated
501 | @@ -499,8 +502,8 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins 502 | const payments::PaymentDetails& details = request.getDetails(); 503 | 504 | // Payment request network matches client network? 505 | - if ((details.network() == "main" && TestNet()) || 506 | - (details.network() == "test" && !TestNet())) 507 | + if ((TestNet() && details.network() != "test") || 508 | + (!TestNet() && details.network() != "main")) 509 | {
in src/qt/paymentserver.cpp:None in b772a43261 outdated
211 | - 212 | PaymentRequestPlus request; 213 | if (readPaymentRequest(arg, request)) 214 | { 215 | - if (request.getDetails().network() == "main") 216 | + if (request.getDetails().network().data() == "main")
Diapolo commented at 8:05 PM on June 4, 2014:Why is .data() needed here now?
rnicoll commented at 10:33 PM on June 4, 2014: contributorFixed the superfluous .data() calls, sorry about that.
in src/qt/paymentserver.cpp:None in 692d2d84a0 outdated
206 | @@ -207,15 +207,18 @@ bool PaymentServer::ipcParseCommandLine(int argc, char* argv[]) 207 | } 208 | else if (QFile::exists(arg)) // Filename 209 | { 210 | - savedPaymentRequests.append(arg);
laanwj commented at 10:14 AM on June 25, 2014:Keep this here - we want the reading to fail later to be able to give an appropriate error message.
laanwj commented at 7:26 AM on July 8, 2014: memberACK after squashing into one commit (it's going back and forth right now).
Payment request parsing on startup now only changes network if a valid network name is specified. 509f926e80rnicoll commented at 9:13 PM on July 8, 2014: contributorOnce more, with feeling...
BitcoinPullTester commented at 9:52 PM on July 8, 2014: noneAutomatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4275_509f926e80b3d24a6b6c6fbf535e4d4b97156a3c/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
laanwj commented at 6:47 AM on July 9, 2014: memberWoohoo :)
laanwj merged this on Jul 9, 2014laanwj closed this on Jul 9, 2014laanwj referenced this in commit 2ee918d121 on Jul 9, 2014rnicoll deleted the branch on Aug 29, 2014MarcoFalke locked this on Sep 8, 2021
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 21:15 UTC
More mirrored repositories can be found on mirror.b10c.me