I'm sorry but I can't reproduce your problem
Check that:
- you have the last version of pywallet (should be 1.9.3 or 1.9.4)
- pywallet returns "key:1Pc6N7aDoxxxxxxx has been successfully deleted from /home/xxx/.bitcoin/wallet.dat, resulting in 2 deleted items"
- you're dumping the wallet that from which you deleted a key (already said I know)
I wasn't using the latest version, but 2.0b9 from march (commit 278c6e0). However, this is getting interesting:
$ pgrep -lf bitco
$ grep ^pywver pywallet.py
pywversion="1.9.3"
$ cp /home/btc/.bitcoin/wallet.dat /some/backup
$ read -s P
$ ./pywallet.py --passphrase="$P" --dumpwallet &>wallet-dump1
$ xxd /home/btc/.bitcoin/wallet.dat >wallet-hex1
$ grep 1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK wallet-dump1
"addr": "1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK",
That is the address I want to delete. Now I run "./pywallet.py --web" and submit the "Delete a key from your wallet" form with this data (copy-pasted here):
Wallet Directory: /home/btc/.bitcoin
Wallet Filename: wallet.dat
Key: 1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK
Type: Bitcoin address
key:1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK has been successfully deleted from /home/btc/.bitcoin/wallet.dat, resulting in 0 deleted item
Python isn't my native tongue but after managing to tweak the code a bit:
$ git diff
diff --git a/pywallet.py b/pywallet.py
index 45370e0..c6bbdb2 100755
--- a/pywallet.py
+++ b/pywallet.py
@@ -1781,16 +1781,19 @@ def delete_from_wallet(db_env, walletfile, typedel, keydel):
elif typedel == "key":
if type == "key":
if keydel == public_key_to_bc_address(kds.read_bytes(kds.read_compact_size())):
+ print "ok deleting key %s of type key" % key
db.delete(key)
deleted_items+=1
elif type == "pool":
vds.read_int32()
vds.read_int64()
if keydel == public_key_to_bc_address(vds.read_bytes(vds.read_compact_size())):
+ print "ok deleting key %s of type pool" % key
db.delete(key)
deleted_items+=1
elif type == "name":
if keydel == kds.read_string():
+ print "ok deleting key %s of type name" % key
db.delete(key)
deleted_items+=1
I don't get any of those lines in stdout:
$ ./pywallet.py --web
'ecdsa' package is not installed, pywallet won't be able to sign/verify messages
2013-04-11 11:11:57+0200 [-] Log opened.
2013-04-11 11:11:57+0200 [-] Starting server: 2013-04-11 11:11:57.506397
2013-04-11 11:11:57+0200 [-] twisted.web.server.Site starting on 8989
2013-04-11 11:11:57+0200 [-] Starting factory
2013-04-11 11:12:11+0200 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [11/Apr/2013:09:12:10 +0000] "GET / HTTP/1.1" 200 29750 "http://localhost:8989/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0"
2013-04-11 11:12:18+0200 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [11/Apr/2013:09:12:17 +0000] "GET /Delete?dir=/home/btc/.bitcoin&name=wallet.dat&keydel=1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK&typedel=key HTTP/1.1" 200 132 "http://localhost:8989/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0"
^C2013-04-11 11:12:31+0200 [-] Received SIGINT, shutting down.
2013-04-11 11:12:31+0200 [twisted.web.server.Site] (Port 8989 Closed)
2013-04-11 11:12:31+0200 [twisted.web.server.Site] Stopping factory
2013-04-11 11:12:31+0200 [-] Main loop terminated.
In fact:
$ ./pywallet.py --passphrase="$P" --dumpwallet &>wallet-dump2
$ xxd /home/btc/.bitcoin/wallet.dat >wallet-hex2
$ md5sum wallet-*
fdffc13c2ee830e46b6b33ea8629ea10 wallet-dump1
fdffc13c2ee830e46b6b33ea8629ea10 wallet-dump2
db862daf9579568a9fcdfba2cd6378b4 wallet-hex1
db862daf9579568a9fcdfba2cd6378b4 wallet-hex2
Something I didn't say yesterday because I didn't think it would have something to do, is the contents of the "reserve" field in the wallet:
$ less wallet-dump1 ## trimmed output
{
"keys": [
"addr": "1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK",
"compressed": true,
"encrypted_privkey": "2d4a14267d220fce36d7c48df789561797743c29cf750ef5a5234faa7ab178ed8ef4e113771bdb9fe3aa4b0c2a94e9e
9", "pubkey": "02e34a2cc7ee8694cd943d58b222a82e181741002151378820216f6e330cee4c31",
"reserve": 1,
"sec": "KxKs8MzyCZ7ufjGsvZNUJtEF9dxuV12geRfM5KCMRofmFXWhbuVr",
"secret": "2100db5080ec709e0e015d669808111de6f5e9c0e8425f126dce4dc1cd8f520601"
},
I could swear that "reserve" was 0 before I tried to delete the key for the first time, and maybe turned into one when I got the "success, 1 key deleted" message. Can this be the reason that today pywallet isn't able to show at least the "1 deleted" message?
I'd be happy to be able to --dumpwallet into a file, edit that file and then --importdump or something like that.