Add safety for broadcast when detected invalid ft transfer rules #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose of this feature is to add safety checks for when broadcasting a tx to ensure the format of the ARC20 input and output balances correctly.
WARNING: It still does not work for mempool txs. Only attempt with confirmed UTXOs.
The broadcast method
blockchain.transaction.broadcast
is now protected with the logic and will throw the same error as the new validation method methodblockchain.atomicals.validate
if it's detected the inputs and outputs will not balance correctly.Examples:
Successfully validated:
https://eptestnet.atomicals.xyz/proxy/blockchain.atomicals.validate?params=[%220200000000010382676c8767a0903a1e252809dd00220c39f5dda82a3b1be9dbc0207c9b6466560000000000ffffffff82676c8767a0903a1e252809dd00220c39f5dda82a3b1be9dbc0207c9b6466560100000000ffffffff2e23e1cd06a396afaf674bcb2b89b66f95a958cbeef8d8292446947955b927190200000000ffffffff01d007000000000000225120c2529c35bacd75646eb3135ca1270325ba2bab5d473b7c8a1eab54b21deea86e0140cb195f49a51b3406114202d54ec0b7b8d832a6d5ecefa0682de714850fa66f5f1677c3543ec9e89b94f9e71076a1ccf5f778ce4423ad8fdce4836e992f0221b301403af2f03dcfd52f758a35f7fb370722545356386a6c33d2489935966545cc7c2064320ec28984002232e4b48ef12b7a10a3d6efb40872668e1de0871789496abb0140e4062a408a65a0d0867349405e0780f6493fc64d071630d8361fc7dbd8d65013285a99e0c1091213135d4a152bbae7f3935be3742bbb8adb2be9146431f647b900000000%22]&pretty
Error validation:
https://eptestnet.atomicals.xyz/proxy/blockchain.atomicals.validate?params=[%2202000000000102f53eff1c70b342676fb320ea50a371bfb0b7d6d528294a608a4aa3a7dfde3db70000000000ffffffffbd1e98390db784e02274db66db224b65ab60eb1be8d5f5afbdde87311d1aa8c60200000000ffffffff015704000000000000225120c2529c35bacd75646eb3135ca1270325ba2bab5d473b7c8a1eab54b21deea86e0140afcdce9cc2245699875611414bc380efa5eceabc10439ceb3e2bb9bf4a3f3b01db330b532ff7a5668973c24cd0280e190fca0b76ddd949dab1f982313a9d003401403d87d88305d122b483454e8ce39033c05e98e0e9c74ee0d71da1fe892147fa021857cea0c4c01be363652ad5951c905cfb48fdbf1534e3c0b9026f5312b15ac600000000%22]&pretty
Also added helper method:
blockchain.atomicals.validate
which takes the rawtx to test if it's validated for ARC20 (inputs and outputs balance).Future Action