Fix : Reject invalid instantsend transaction #1583
Merged
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.
Using
sendrawtransaction
with arguments asking for a instantsend transaction (third argumentinstantsend
attrue
).If our hexstring use a UTXO having less than 6 confirmations, it will be invalid.
While we will have our response being
Not a valid InstantSend transaction, see debug.log for more info
, the sent rawtx, will still be processed as a normal transaction.The problem is that :
This is due because we first add to the mempool the transaction, and only after, we check that it's indeed a instantSend valid tx. If it's not we throw an error.
See exemple here :
http://dev-test.insight.dashevo.org/insight-api-dash/tx/bf399bcb7df27849590334bf660d79ac414a9a4f955a9c596d8dfc1ad92a851b
But you still see that the transaction has been sent, with
txlock:false
.How to reproduce :
Fix :
By moving the verification and error throwing before we add to the mempool, the transaction won't be propagated at all.
Tested working on a Ubuntu 17.04 through Insight-API v0.5
/tx/sendix
.I didn't found any test-case to update.