-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override Fee Overpayment Protection via RPC #12124
Override Fee Overpayment Protection via RPC #12124
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cACK
tested, it works
Should it also be added to send
method?
The problem with this approach is that it makes the array representation impossible to use. Let me explain: in the early days this method looked like this: public string BuildTransaction(PaymentInfo[] payments, OutPoint[] coins, int feeTarget, string password = null) This is perfectly okay because you can call the method using the json object representation and the json array representation. For example, both calls below just worked equally well: $ curl -s \
-H -- 'content-type: text/plain;' \
--binary-data '{"jsonrpc":"2.0","id":"1","method":"send", "params": { "payments":[ {"sendto": "tb1qgvnht40a08gumw32kp05hs8mny954hp2snhxcz", "amount": 15000, "label": "David" }], "coins":[{"transactionid":"ab83d9d0b2a9873b8ab0dc48b618098f3e7fbd807e27a10f789e9bc330ca89f7", "index":0}], "feeRate":234 }}' \
http://127.0.0.1:37128/<wallet-name> And $ curl -s \
-H -- 'content-type: text/plain;' \
--binary-data '{"jsonrpc":"2.0","id":"1","method":"send", "params": [ [ {"sendto": "tb1qgvnht40a08gumw32kp05hs8mny954hp2snhxcz", "amount": 15000, "label": "David" }], [{"transactionid":"ab83d9d0b2a9873b8ab0dc48b618098f3e7fbd807e27a10f789e9bc330ca89f7", "index":0}], 234 ]}' \
http://127.0.0.1:37128/<wallet-name> Now, after #11667 this magic was broken and while the json object representation works perfectly, the array representation doesn't work anymore if we don't pass all parameters. This sucks bad and it was merged only after a year because i didn't find a better solution and I believed it was not a big deal. After this PR the situation gets a bit worse, and it will become even worse after every additional parameter, so, for all RPC methods devs can use both json representations except for this one (or they are forced to pass all the parameters). Before continue let me accept that I am the one that ruined it. But now I feel (am) guilty and don't want to let it be worse.
Finally expose both as RPC methods. |
tack f00da95 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
Thanks for the PR.
Should we add a comment in the code for buildunsafetransaction
RPC? I know RPC calls are documented, but quickly explaining how this call is unsafe might be beneficial
Is it unsafe, or just expensive? |
This PR doesn't do any magic, only it lets you choose whatever fee/feeRate you want for the transaction. Let's say, I make a transaction: Do you consider this transaction unsafe or just expensive? When the fees are high like now, it can happen that the user wants to send a small amount with high fee, but the Tx building fails because of this safety check in
This PR aims to go around this check and let the tx be built. |
Anything else is missing from this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-ack 7586511
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cACK, LGTM - except one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code ACK
@MarnixCroes @yahiheb can you test this by using the RPC? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tack 1cf1372
Fixes: #12118
I went with this comment #12118 (comment), so this overriding "mechanism" only works via RPC for now.
How to test:
build
RPC endpoint with a small outgoing amount and huge fees.TransactionFeeOverpaymentException
exception.buildunsafetransaction
endpoint with a small outgoing amount and huge fees.@turbolay @MarnixCroes Could you guys test this please? Much appreciated!!