dcrwallet icon indicating copy to clipboard operation
dcrwallet copied to clipboard

multi: Return error when sending existing tx.

Open JoeGruffins opened this issue 3 years ago • 2 comments

In chainntfns return an error after logging when a processed transaction
already exists. Change all call sites except the wallet publish
transaction to ignore these errors to ensure previous behavior of
ignoring.

closes #2080

JoeGruffins avatar Oct 06 '21 07:10 JoeGruffins

proof
[joe@hyrule harness-ctl]$ ./alpha sendtoaddress SsnbEmxCVXskgTHXvf3rEa17NA39qQuGHwQ 10
645f98fcb8552944aedb05f590bf19189c15906e56d359121d60f98357f74d68
[joe@hyrule harness-ctl]$ ./alpha getrawtransaction 645f98fcb8552944aedb05f590bf19189c15906e56d359121d60f98357f74d68 | ./alpha sendrawtransaction -
645f98fcb8552944aedb05f590bf19189c15906e56d359121d60f98357f74d68
[joe@hyrule harness-ctl]$ ./alpha getrawtransaction 645f98fcb8552944aedb05f590bf19189c15906e56d359121d60f98357f74d68 | ./alpha sendrawtransaction -
645f98fcb8552944aedb05f590bf19189c15906e56d359121d60f98357f74d68
[joe@hyrule harness-ctl]$ ./mine-alpha 1
[
  "66e7f3fa5ede9fdcc892ac2976008763dc31997b14f137ba4d39a87e46804b68"
]
[joe@hyrule harness-ctl]$ ./alpha getrawtransaction 645f98fcb8552944aedb05f590bf19189c15906e56d359121d60f98357f74d68 | ./alpha sendrawtransaction -
-4: wallet.PublishTransaction(645f98fcb8552944aedb05f590bf19189c15906e56d359121d60f98357f74d68): item already exists:: wallet.processTransactionRecord: Refusing to add unmined transaction 645f98fcb8552944aedb05f590bf19189c15906e56d359121d60f98357f74d68 since same transaction already exists mined

There could be something else that returns errors.Exists, however processTransactionRecord is pretty huge so would like some input on wether this looks like the right way to do this. I think we could also just check watchOutPoints is not nil and recreate the error string in the rpcserver method handler.

JoeGruffins avatar Oct 06 '21 07:10 JoeGruffins