zcash-swift-wallet-sdk icon indicating copy to clipboard operation
zcash-swift-wallet-sdk copied to clipboard

Add a test to check if it's possible to brick the autoshielding using dust

Open defuse opened this issue 4 years ago • 0 comments

  1. Initialize an empty wallet.
  2. Send the wallet enough 1 zat UTXOs that an attempt to spend them all would be larger than the block size.
  3. Try to autoshield, it should fail because it notices it can't pay the fee in a transaction that's small enough to be valid.
  4. Now send the wallet a 1000 zat UTXO, and try to autoshield, it should be smart enough to use the 1000 zat UTXO to build a transaction that vacuums up some of the dust.

If (4) fails, then it's possible to brick a wallet by sending it lots of dust.

The UTXO selection algorithm needs to be smart enough to select the higher-value notes first in order to pay the fee, and stop including more UTXOs once it reaches the transaction size limit. This test will confirm it's doing the right thing.

defuse avatar Jan 28 '21 17:01 defuse