Submit completed tests by making a pull request from your fork of this project.
Test environment:
A Linux machine running a raw-transactions-API-capable version of bitcoind/Bitcoin-Qt (version 0.7.2 or git HEAD), with python and a python jsonrpc library installed.
A testnet wallet that has a greater-than-zero balance and has sent and received bitcoins.
No bounties for this, I hope people who need the 'coin control' feature will help test.
- Backup your main wallet.dat (if it contains any bitcoins; better safe than sorry!)
- Make sure you have a bitcoin.conf file in your bitcoin data directory with rpcuser/rpcpassword set.
- Run bitcoind/Bitcoin-Qt version 0.7.2 or later with the -testnet flag
- Download https://github.com/gavinandresen/bitcoin-git/raw/spendfrom/contrib/spendfrom/spendfrom.py
If you need testnet bitcoins, ask in the #bitcoin-dev IRC channel or get some from http://tpfaucet.appspot.com/
Run:
spendfrom.py --testnet
EXPECT:
See list of addresses and balances.
Run the following, replacing $ADDRESS and $AMOUNT with an address/amount available to spend:
spendfrom.py --testnet --from=$ADDRESS --to=mrhz5ZgSF3C1BSdyCKt3gEdhKoRL5BNfJV --amount=$AMOUNT
EXPECT:
- transaction id returned
- transaction sent from your wallet to the testnet faucet (your balance decreases by $AMOUNT)
Run the following, replacing $ADDRESS with another address that is available to spend and has less than 99 testnet coins::
spendfrom.py --testnet --from=$ADDRESS --to=mrhz5ZgSF3C1BSdyCKt3gEdhKoRL5BNfJV --amount=99
EXPECT: error complaining that $ADDRESS doesn't have that many coins.
Run the following, replacing $ADDRESS1 with another address that has coins, $ADDRESS2 any other address in your wallet,
and $AMOUNT an amount less than the amount available from $ADDRESS1:
spendfrom.py --testnet --from=$ADDRESS1,$ADDRESS2 --to=mrhz5ZgSF3C1BSdyCKt3gEdhKoRL5BNfJV --amount=$AMOUNT
EXPECT:
- transaction id
- Run bitcoind/bitcoin-qt -testnet getrawtransaction $txid : the transaction should have two outputs, one to $ADDRESS2 and the other to the testnet faucet.
Choose two addresses that have coins available (run spendfrom.py --testnet with no arguments), and total the amount of coins available from those two addresses. Then run:
spendfrom.py --testnet --from=$ADDRESS1,$ADDRESS2 --to=mrhz5ZgSF3C1BSdyCKt3gEdhKoRL5BNfJV --amount=$AMOUNT
EXPECT: transaction id, wallet balance goes down by $AMOUNT
Choose an address with coins available, and create a send-to-self transaction for less than the total amount available:
spendfrom.py --testnet --from=$ADDRESS --to=$ADDRESS --amount=$AMOUNT
EXPECT: send-to-self transaction created with one output that sends more than $AMOUNT coins from $ADDRESS to $ADDRESS (because sendfrom.py combines leftover change with $AMOUNT and sends it to $ADDRESS).
Attempt to send a tiny amount without paying a fee:
spendfrom.py --testnet --from=$ADDRESS --to=mrhz5ZgSF3C1BSdyCKt3gEdhKoRL5BNfJV --amount=0.00001
EXPECT: error
Attempt to send with an outrageous fee:
spendfrom.py --testnet --from=$ADDRESS --to=mrhz5ZgSF3C1BSdyCKt3gEdhKoRL5BNfJV --amount=0.01 --fee=1.0
EXPECT: error
- Quit bitcoind/Bitcoin-Qt
- Run spendfrom.py
EXPECT: helpful error message