Closed yashasvi-ranawat closed 9 months ago
yes, both will work! The problem arises when you send all, but don't specify leftover as cashtoken address.
key.send([])
This fails because the leftover defaults to key.address! and cashtokens cannot be sent to an address that doesn't signal cashtoken.
This fails because the leftover defaults to key.address! and cashtokens cannot be sent to an address that doesn't signal cashtoken.
Isn't that normal? To avoid sending to a non cashtoken address and potentially lose the funds?
Isn't that normal? To avoid sending to a non cashtoken address and potential lose the funds?
I recon that if the leftover is not specified, that implies the leftover will come back to the wallet. And bitcash wallets do support and signal cashtokens. It is just that in the leftover, it uses non cashtoken signalling address, which is a bug.
However, if the user wants another leftover address, and that leftover doesn't signal cashtoken, then an error will rightfully be raised.
potential lose the funds?
Just to clarify, the cashtoken implementation is different than SLP. If a cashtoken unaware wallet receives cashtokens, then either:
It can't accidentally burn them because the transaction pre-image is very different.
I recon that if the leftover is not specified, that implies the leftover will come back to the wallet. And bitcash wallets do support and signal cashtokens. It is just that in the leftover, it uses non cashtoken signalling address, which is a bug.
Ah right, that makes sense!
And thanks for explaining the details of CashToken, which I am not familiar with. It's good to know funds can't be burnt accidentally like this, definitely an improvement over SLP!!
it did not run in GitHub Actions, you might need to enable it on your fork's settings for future PRs
The run_tests workflow also has coverage upload to Codecov in them. The tests in my fork are successful in the run tests part but not upload to Codecov part. Any fork won't have access to the secrets that bitcash uses for the same. Maybe we can split the coverage upload and the testing parts? Or maybe there's another solution to it, that I don't know.
Ah yes, I see the failed codecov step in your fork. That makes sense it doesn't have access to the secrets...
Not really something important, but I'll update with something like: https://github.com/marketplace/actions/python-coverage that doesn't require an external service...
During review, the key.address was reverted to cashaddress that doesn't signal cashtoken support. However, no unit tests caught the error when leftover address defaults to key.address. This implied that if a wallet had cashtoken and a leftover address wasn't specified, the leftover cashtokens were not sent and failed every transaction.
This pull request fixes this, and adds a test for the case.