Skip to content

Conversation

@gavinandresen
Copy link
Contributor

Adds a regression test for the wallet's ResendWalletTransactions function,
which uses a new, hidden RPC command "resendwallettransactions."

I refactored main's Broadcast signal so it is passed the best-block time,
which let me remove a global variable shared between main.cpp and
the wallet (nTimeBestReceived).

I also manually tested the "rebroadcast unconfirmed every half hour or so" functionionality by:

  1. Running bitcoind -connect=0.0.0.0:8333
  2. Creating a couple of send-to-self transactions
  3. Connect to a peer using -addnode
  4. Waited a while, monitoring debug.log, until I see:
    2015-03-23 18:48:10 ResendWalletTransactions: rebroadcast 2 unconfirmed transactions

One last change with this pull request: don't bother putting ResendWalletTransactions messages in debug.log unless unconfirmed transactions were actually rebroadcast.

@jonasschnelli
Copy link
Contributor

utACK.

Two points:

Would it make sense to somehow remove this command when running in a non test/dev. mode? I don't have a good idea here (detect --enable-debug, only during --regtest & --testnet seems not to be the best approach).

How about returning a array of rebroadcasted wtx ids instead of a single count int?

@gavinandresen
Copy link
Contributor Author

@jonasschnelli : consensus on IRC was just making it hidden is the right thing to do.

RE: returning array of txid: good idea, I'll do that.

And I'll fix the -DDEBUG_LOCKORDER travis error (RPC method needs to lock cs_main).

@gavinandresen
Copy link
Contributor Author

Updated.

Note: I decided on std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime) instead of passing in a reference to a vector that is filled in because the vector will be small (if you have lots of unconfirmed transactions in your wallet you are doing something wrong).

@jonasschnelli
Copy link
Contributor

Tested ACK.

@luke-jr
Copy link
Member

luke-jr commented Mar 23, 2015

This test appears that it would fail to catch an error, if mempool syncing is ever merged. It would be better if the nodes were all restarted concurrently to clear their mempools, but failing that perhaps just a comment on this limitation in the test code would be good to have.

@laanwj
Copy link
Member

laanwj commented Mar 24, 2015

utACK

This test appears that it would fail to catch an error, if mempool syncing is ever merged.

We'll worry about that then, and if. Could add a comment, I guess.

@gavinandresen
Copy link
Contributor Author

@luke-jr : if mempool syncing between peers is implemented, then ResendWalletTransactions will probably go away entirely, so this unit test will be obsolete.

I suppose I could add a comment, but I think it is usually a mistake to clutter up code with speculative comments about code that may or may not get written in the future.

Adds a regression test for the wallet's ResendWalletTransactions function, which uses a new, hidden RPC command "resendwallettransactions."

I refactored main's Broadcast signal so it is passed the best-block time, which let me remove a global variable shared between main.cpp and the wallet (nTimeBestReceived).

I also manually tested the "rebroadcast unconfirmed every half hour or so" functionality by:

1. Running bitcoind -connect=0.0.0.0:8333
2. Creating a couple of send-to-self transactions
3. Connect to a peer using -addnode
4. Waited a while, monitoring debug.log, until I see:
```2015-03-23 18:48:10 ResendWalletTransactions: rebroadcast 2 unconfirmed transactions```

One last change: don't bother putting ResendWalletTransactions messages in debug.log unless unconfirmed transactions were actually rebroadcast.
@laanwj laanwj merged commit 0f5954c into bitcoin:master Mar 30, 2015
laanwj added a commit that referenced this pull request Mar 30, 2015
0f5954c Regression test for ResendWalletTransactions (Gavin Andresen)
@gavinandresen gavinandresen deleted the resend_test branch April 24, 2015 14:46
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants