caravan-bitcoin/caravan

Bug: possible to construct a transaction with an output equal to an input

Opened this issue · 0 comments

Original issue: unchained-capital/caravan#116

Expected Behavior

Should not be able to construct a transaction with an output address equal to an input address.

Current Behavior

It's possible to construct a transaction with an output equal to an input

See also the gif and screenshot:
82491851-407d5300-9ab3-11ea-957e-b1d037e21946
82491854-4115e980-9ab3-11ea-9bc2-f8f79299b56a

Note that in the gif I don't sign the transaction but it is possible to do so, see https://blockstream.info/testnet/tx/861c1201d3600adc2b17bc4b1cdb0764aaf1c0d891ca581e2080044a2f33e6c1?expand

Possible Solution

Prevent the above and show an error message.

Steps to Reproduce (for bugs)

  1. Setup a funded wallet
  2. Copy an address and note the balance
  3. Paste the address into the output text field
  4. Set the amount to the same amount as the address balance
  5. Click preview transaction
  6. Note that one of your output addresses is the same as one of your input addresses

Environment

  • Where are you running caravan: localhost
  • Operating system: Linux
  • Browser and version: Chrome

caravan@0.2.0 /home/walden/code/caravan

├── unchained-bitcoin@0.0.13 
└─┬ unchained-wallets@0.0.12 
  └── unchained-bitcoin@0.0.12 

npm: 6.14.4 
node: v12.16.2
Linux 5.6.13-arch1-1 #1 SMP PREEMPT Thu, 14 May 2020 06:52:53 +0000 x86_64 GNU/Linux