see title.
Did some quick testing, seems to work...
see title.
Did some quick testing, seems to work...
Thanks for having a shot at this.
I agree with the UI part. However the core part should be more generic. The core doesn't need to know about UI-only data structures such as CReceiveRequestEntry.
My idea was to offer a interface for storing general-purpose data on destinations in the wallet. See #3281 and store payment requests and bitcoin URIs in there.
However, it is nearly impossible to get changes to the core wallet code reviewed (and you need very good tests/testplan), and I had tons of other things to do, this needs to be re-thought post-0.9.
How about using Boost.Serialization, serializing the SendCoinsRecipient as xml/string and storing this in the wallet. Could this work / Is a good idea?
I'd rather not import another serialization format.
We can use the bitcoin serialization format (used for most stuff in the wallet) or google protobuf (as used for payment requests).
The important part is that the serialization happens on the src/qt side, and not in the core, as to not burden the core with knowledge it doesn't need to know about.
It's most likely if you keep the core changes as small and non-invasive as possible. Basing on #3281 is a good idea I think as it only adds a minimal amount of code.
I can't guarantee anything though. I'll just merge GUI changes, but core changes need more extensive scrutiny.
Ok, in any case it'd be very welcome!
Implementation looks good, I plan to test this in the coming week.
Locking: Don't forget that the DestData functions on CWallet (just like the other address book manipulation functions) require a lock on cs_wallet before calling, as they don't acquire the lock themselves.
Sounds good. Added the lock.
Indeed, deleting multiple rows at once seems to be broken. It deletes a different subset than asked (only visible after a restart).
Apart from that it works great. Changing the ordering is not a big issue.
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/4d901023b732efb492d89cebd8555c689ab7663e 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.
I have some questions/suggestions. What do you think about them?
display (no amount) instead of 0.00, similar to (no label) (no message)
rename table headline "Requested payments" => "History"
Change description from "Use this form to request payments." to "Use this form to create bitcoin addresses and URIs" I dont like the term request payment. Someone may think you are actually requesting something from the network, but you are just creating a request.
Rename button "Request payment" to "Create Address/URI" or "Create payment information" (Could also say "generate" instead of create)
Move this button to the left aligned with the textfields, otherwise the mouse ways are long. Put Clear button right to this button or even remove Clear button, with only 3 fields there, the Clear button is not so important.
Write a sentence above the 2 fields amount and message: "Amount and message are useful when using bitcoin URIs (bitcoin:1abc...) They appear in someones client when clicking the URI" Otherwise people may be confused and think they always have to specify the amount now, to receive coins.
What is the intention with the message field? Shouldnt this appear in sendcoinsdialog, when I click an URI. Is this field even used anywhere currently? Should I implement this? If I understand this correctly the message is ignored when clicking on a simple URI.
Emphasize all fields being optional a little better: "All fields are optional!" or "All fields are OPTIONAL" or even write next to every label (optional)
Draw a border around the upper form elements.
How about instead of the checkbox "Reuse an existing address" make a combo box "Address:" default is "Generate new bitcoin address (recommended)" and then fill the combo with all addresses ordered by label, address? Combo box could be placed below "Label" above message and amount.
ok
History may be too general, don't forget there is transaction history too
3/4) But eventually this form will be used to create payment requests (BIP 0070). It doesn't do that yet, which may be confusing, sure... Maybe a better word would be "invoice"?
Aligning the 'action' button to the right and the clear button to the left is consistent with the 'send' tab. Don't change this individually.
Fine with me
The message is a standard field that gets embedded in the bitcoin: URI. It is a message for the recipient of the "invoice". Our client doesn't use it currently, but the idea is that it gets saved with the transaction at the sender (it does not get sent over the network). Maybe hide/remove it for now?
Good idea. I like "All fields are OPTIONAL". Don't write it next to every label, I tried that and it's ugly (also tried using * and put the message below, but it looks strange if it applies to all fields).
Fine with me
The number of addresses in the wallet can be huge, please don't put them in a combo box. We want to go away from the idea of addresses being something you have easily graspable, limited quantity of. I'm not even sure we should have this option at all.
Please make a new issue for those changes. This pull request should be ready for testing/merging right? No need to hold it up.
564 | + vReceiveRequests.push_back(item2.second); 565 | +} 566 | + 567 | +bool WalletModel::saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest) 568 | +{ 569 | + CTxDestination dest = CBitcoinAddress(sAddress).Get();
Any need to handle or any chance to see invalid addresses here?
I don't think so: a payment request is always generated with one of our own addresses, which are correct by definition.
Edit: though I suppose it wouldn't hurt to check to prevent storing information on CTXNoDestination
17 | +class RecentRequestEntry 18 | { 19 | +public: 20 | + RecentRequestEntry() : nVersion(RecentRequestEntry::CURRENT_VERSION), id(0) { } 21 | + 22 | + static const int CURRENT_VERSION=1;
Minor personal nit: missing spaces
45 | +class RecentRequestEntryLessThan 46 | +{ 47 | +public: 48 | + RecentRequestEntryLessThan(int nColumn, Qt::SortOrder fOrder): 49 | + column(nColumn), order(fOrder) {} 50 | + bool operator()(RecentRequestEntry &left, RecentRequestEntry &right ) const;
Minor personal nit: space after right
@laanwj @Diapolo I do prevent storing to CNoDestination, but in wallet.cpp, CWallet::AddDestData. I hope this is ok. @laanwj Thanks for your feedback, I will open a new pull for the other changes. Yes this one is ready for testing. I did not follow any testplan, just randomly sorted, added, deleted rows, then restart to check, if everything gets restored correctly. Works for me so far. @Diapolo Unless there is any other update to this pull, I will put your nits in a future pull request.