No Branch/Tag Specified
arm
asyncnotedecryption
danger
dev
dev-aarch64
dev-mac
dev-old-randomx
divzaddrs
dragonx
duke
freebsd
getfilterednotes
hip39
hushutils
insync
jahway603
master
mvstuff
onryo
p2p_privacy
ramhash
relaytx
rx-largepages
setbestchain
warmup
witness_cache
wolfssl
wolfssl_win
z_createrawtransaction
z_importwallet
z_signmessage
v0.11.2.z0
v0.11.2.z1
v0.11.2.z2
v0.11.2.z3
v0.11.2.z4
v0.11.2.z5
v0.11.2.z6
v0.11.2.z7
v0.11.2.z8
v0.11.2.z9
v1.0.0
v1.0.0-beta1
v1.0.0-beta2
v1.0.0-rc1
v1.0.0-rc2
v1.0.0-rc3
v1.0.0-rc4
v1.0.1
v1.0.10
v1.0.10-1
v1.0.11
v1.0.11-rc1
v1.0.12
v1.0.12-rc1
v1.0.13
v1.0.13-rc1
v1.0.13-rc2
v1.0.14
v1.0.14-rc1
v1.0.15
v1.0.15-rc1
v1.0.2
v1.0.3
v1.0.4
v1.0.5
v1.0.6
v1.0.7-1
v1.0.8
v1.0.8-1
v1.0.9
v1.1.0
v1.1.0-rc1
v1.1.1
v1.1.1-rc1
v1.1.1-rc2
v1.1.2
v1.1.2-rc1
v2.0.0
v2.0.0-rc1
v2.0.1
v3.0.0
v3.1.0
v3.1.1
v3.10.0
v3.10.1
v3.10.2
v3.2.0
v3.2.1
v3.2.1-alpha
v3.2.1-beta
v3.2.2
v3.2.3
v3.3.0
v3.3.1
v3.3.2
v3.4.0
v3.4.1
v3.5.0
v3.5.1
v3.5.2
v3.6.0
v3.6.1
v3.6.2
v3.6.3
v3.7.0
v3.7.1
v3.8.0
v3.9.0
v3.9.1
v3.9.2
v3.9.3
v3.9.4
Labels
bounty up to 500 HUSH 2001-5000 bounty
bounty between 2001 and 5000 HUSH 501-2000 bounty
bounty between 501 and 2000 HUSH arm
something doesn't work on arm beginners
for new developers bug
may or may not be a bug build
problems building documentation
not enough information feature
new feature high priority
high priority i2p
related to i2p low priority
low priority medium priority
medium priority question
something is not clear release
release label or issue related to it testing
related to testing tor
related to tor wontfix
this won't be fixed
Apply labels
Clear labels
0-500 bounty
bounty up to 500 HUSH 2001-5000 bounty
bounty between 2001 and 5000 HUSH 501-2000 bounty
bounty between 501 and 2000 HUSH arm
something doesn't work on arm beginners
for new developers bug
may or may not be a bug build
problems building documentation
not enough information feature
new feature high priority
high priority i2p
related to i2p low priority
low priority medium priority
medium priority question
something is not clear release
release label or issue related to it testing
related to testing tor
related to tor wontfix
this won't be fixed
No Label
0-500 bounty
2001-5000 bounty
501-2000 bounty
arm
beginners
bug
build
documentation
feature
high priority
i2p
low priority
medium priority
question
release
testing
tor
wontfix
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
This issue currently doesn't have any dependencies.
Reference in new issue
There is no content yet.
Delete Branch '%!s(MISSING)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
This code is currently on the
zsweep
branch, checkout that branch to do testing.zsweep has various config file options, but the most basic usage just requires two:
By default a node will only sweep to a zaddr in the current wallet.dat. To sweep funds out of the current wallet set
zsweepexternal=1
:By default
zsweep
runs every 5 blocks. To change it:By default
zsweep
makes sure to not reduce the anonset in any tx by having a maximum number of inputs of 8. This should be fine for new wallets, but if you have an existing wallet with many zutxos it can be changed like this:Large values will make sweeping faster at the expense of reducing the anonset.
The default zsweep fee is 10000 puposhis or 0.0001 HUSH, the default for all transactions. To use fee=0 for zsweep transactions:
Things To Test
To see if zsweep tx's have happened on your node, you can do
grep -i sweep ~/.hush/HUSH3/debug.log
I am still waiting for test node to finish syncing, but first 4 tests all passed for me as far as either the node giving meaningful error and stopping or starting correctly when zsweep=1 and zsweepaddress=zaddr in wallet. I'll test actual functionality when finished syncing.
Setting an invalid zsweepinterval (0 or negative) gives error and stops node
I tested with 0 and negative. It gives this message and continues running node with default of 5. I think this is appropriate way to handle if everything else is valid unless we should stop node on error for anything invalid.
main_impl: Invalid sweep interval of -22, setting to default of 5
Message is also output every 5 blocks.
Checking
z_getoperationstatus
, I get output like this every 5 blocks. This is when there are no funds to sweep, so no txs created.Trying to sweep to external, I get this in debug.log.:
AppInit2: sweeping funds to a zaddr in an external wallet
Empty result when I check
z_getoperationstatus
and doesn't appear to work. Funds stay in address of local node. I addedconsolidation=1
at same time as adding external config and may be related. Need to test withoutconsolidation=1
as it seems it might make zsweep not work at all. I tested switching back to local address and removingzsweepexternal=1
and zsweep was never running withconsolidation=1
.Sweeping funds from one address that's already been swept to, to a new address seems to report incorrect total and double what was swept. Actual amount was 13.9987:
Setting a zsweepaddress outside wallet and zsweepexternal=1 works correctly
Confirmed this works correctly as long as not using consolidation=1. consolidation=1 seems to break zsweep whether using local or external address.
I had to reindex test node because it started showing incorrect low balance in sweep address. Tried rescan first, but still low balance after sweeping. I was trying to send tx every 2-3 minutes and setting zsweepinterval high to test zsweepmaxinputs.
Lots of txs might end up requiring frequent reindexing if something gets jacked up to prevent double spending. This isn't too helpful because I don't have exact message but it was saying something about tx not found during node startup for a bunch of txids and I have a bunch of sapling nullifier exists, prevent double spend in log. May have been calling z_sendmany too quickly or when in invalid state. I'll test more once reindexing finishes.
@fekt giving a warning and setting to a default value is more user-friendly behavior, I agree, so I changed the checklist item and checked that box. Thanks.
@fekt do you like the current behavior of it giving the warning every X blocks that the value was invalid (makes it more likely the user will see it) or should we update the value so it doesn't spam debug.log as much?
As for the amount swept being incorrect and exactly double, I think it's counting how much is swept out of any zaddr plus how much is swept in to the zsweepaddress, which is not that useful. It should either count how much is swept out of addresses or how much is swept into the zsweepaddress.
I have a hunch on why consolidation=1 and zsweep=1 together are not working. I made sweeping run every 5 blocks but there is logic in consolidation that says "if we are less than 15 blocks until the next sweep, don't run consolidation" and since we are always less than 15 blocks until the next sweep, consolidation never actually runs, it bails out early every time.
This is what I was getting on startup when balance incorrect. It seemed to run OK for awhile until balance got too low.
tx hash 791d2998b4584590823cde3dff3d20d95cdb4601643a36d5952437974ef842fb does not exist!
A bunch of them with different hashes as well as
tx is unconfirmed
likely for all the related txs and why balance shows incorrect. Seems to think they are spent, but uncofirmed and not actually spent. Also, sometimes get a hash or txid of all 0's, but not sure if from zsweep or existing bug being highlighted by sending a bunch of txs on cron. I was sending 2 txs every 2 minutes.If I rescan, all those messages still show and balance still incorrect until reindexing. Happened again overnight where balance too low to continue sending txs on cron. It still runs zsweep regularly, but with 0 amount.
This is with no longer using consolidation=1. I am also using deletetx=1 and have zindex=1 if it makes any difference.
I am testing on another node that has been fine for over 12 hours so far.
I think it is fine to show it every interval so user is more likely to see it and change it. It is trade off with spamming log, but I don't think it's necessary to change it for them since it's using default value anyway.
@fekt if
zsweepexternal=1
is set but thezsweepaddress
is in the current wallet.dat, should we give a warning or error? This is something we can automatically detect and tell a user if they think they are sweeping to an external wallet, but they actually are not.Since it's advanced feature, I think a warning is fine every interval if it still sweeps to the address specified, regardless if external or not. Funds never leave their wallet. If it makes more sense with existing logic to error on start, that's fine too though.
Not sure if it's just my wallet or VPS it's on, but I tried latest commit over the weekend and kept getting core dumps. I ended up creating new wallet.dat and was still getting core dumps without sending any transactions and just letting it sweep. I'll check logs later when I can, but I do notice multiple sweep operations that get cancelled before one ends up having a success response. This is with no funds that actually need to be swept and all funds already in sweep address. I was also no longer using consolidation=1. When I did try consolidation=1 initially on latest commit, I was seeing consolidation operations happen and no sweeps, but may not have let it run long enough before changing config or too many inputs so it wasn't trying to sweep. I created new wallet.dat because z_sendmany kept failing and balances incorrect even after multiple reindexes and rescans.
On another test node, which I did not update to latest commit and isn't using consolidation=1, I am also running into the same issue where I end up with a decent amount of txs stuck in mempool that never confirm so balances remain low. I have multiple with hashes or txids of all 0's mixed with real txids that are locking funds and keeping balance low. I have not experienced core dumps on this one yet.
Getting core dumps on two nodes now. One of them is basically a new wallet with new addresses and only 100 kb. This is a VPS with 4 GB of RAM and 2 CPU on latest commit. Not sure if helpful but these are last entries in log:
Last entries in other node, which has 100 MB wallet.dat and physical machine with 8 GB of RAM and 6-core CPU. This is not on latest commit:
I am reindexing VPS again. Physical, I changed to send 1 tx every 3 minutes in case it was crashing from high load.
@duke This is backtrace from last core dump.
Above coredump was fixed. zsweep functionality seems to mostly work (at least when not used with consolidate=1 or deletetx=1), we should open up new issues for specific issues that are found.