Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: piotr_n on March 22, 2013, 08:59:51 PM



Title: Question about shy & simple pull requests
Post by: piotr_n on March 22, 2013, 08:59:51 PM
I usually compile the client myself since I often have some small patches which I like to use.
I've always been shy to submit any poll request for such, mostly because I'm not really sure how welcome they  to be, and nobody likes being rejected :)

Let ma give you some example.
From time to time I get requests from people I know who have problems with their wallets and so they want me to fix it.
Usually it's because they used to work with several wallets at the same PC, and so they ended up with transactions that have only a question sign, and zero confirmations...
Normally I just tell them to use the "-rescan" option, but sometimes it doesn't help, because the transaction they have in the wallet was somehow a double-spend, and then the only way to fix their wallet is to remove all the transactions and then do the rescan.
So I have this simple patch in init.c, which goes like this:
Code:
bool AppInit2()
{
    // ...
    if (GetBoolArg("-rescan"))
    {
        pindexRescan = pindexGenesisBlock;
        // And here goes my code:
        if (GetBoolArg("-purgetransactions"))
        {
            for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
            {
                CWalletTx* wtx = &((*it).second);
                pwalletMain->EraseFromWallet(wtx->GetHash());
            }
        }
    }
    // ...
}
As you can figure, it basically removes all the local txs from the wallet, if you use both "-rescan" and "-purgetransactions" at the same time.

So: would it be useful enough to bother with a pull request?
And if it would - do I need to add some test cases for it, or what?


Another example, though a bit more complex, would be a possibility to use * as the <fromaccount> for sendmany command.
It's just weird that you cannot specify "any account" there, and I have an application that really sucks because of it.


If such a simple patches are be welcome, I'm more than happy to create some pull requests for them, but if not - no problem, I will just keep patching them in myself.
So please let me know what you think.


Title: Re: Question about shy & simple pull requests
Post by: jackjack on March 24, 2013, 04:02:15 PM
About your specific problem, if it's enough tested yeah I find it useful. I spent several hours to implement transactions support in pywallet because back in the days there was no way to delete those famous 0/unconfirmed transactions

I'm also wondering about the case of simple pull requests... What are the requirements to send some and it being accepted?
Make a successful thread about it in dev/tech discussion? Make theymos/Gavin/etc agreeing with you? Nothing? Luck? Prayers to Satoshi?


Title: Re: Question about shy & simple pull requests
Post by: kjj on March 24, 2013, 05:42:49 PM
About your specific problem, if it's enough tested yeah I find it useful. I spent several hours to implement transactions support in pywallet because back in the days there was no way to delete those famous 0/unconfirmed transactions

I'm also wondering about the case of simple pull requests... What are the requirements to send some and it being accepted?
Make a successful thread about it in dev/tech discussion? Make theymos/Gavin/etc agreeing with you? Nothing? Luck? Prayers to Satoshi?

No formal requirements, no formal process (that I've seen).

Make the pull request, people will see it, comment, etc.  If there are no big objections and at least a couple of ACKs, it'll get pulled.  Most of the discussion happens on the github page and in IRC.  Try to make sure your branch is correct and complete before you make the request.  If your patch is not totally trivial, you'll need to make some changes before it'll be accepted, but it looks bad when the build tester bot reports that your pullreq can't compile.

As for the two specific examples in this thread, I like the -purgetransaction option.  Personally, I'd prefer an RPC call that selectively removes one transaction without needing a restart, but this would still come in handy at times.  As for the source for sendmany, can't you just specify the default account with an empty string "" ?