Repository navigation
Removed redundancies in withdraw and fundchannel. - #1399
Conversation
|
ACK 2b79542 Please rebase and we should merge this too... |
|
I'm not really sure where I went wrong here. The tests sometimes pass and sometimes don't on my home machine. It might be better to discard this pull request and let me recreate another. |
|
Oh I didn't realize master was broken atm. Will wait. |
| wtx->desttok = NULL; | ||
| } | ||
|
|
||
| bool wtx_json_get_params(struct wallet_tx * tx, const char * buffer, |
There was a problem hiding this comment.
I'd rather have this in the JSON-RPC file, since this adds a tight coupling of the two.
| } | ||
|
|
||
| bool wtx_json_get_params(struct wallet_tx * tx, const char * buffer, | ||
| const jsmntok_t *params, const char * dest) |
There was a problem hiding this comment.
It's also seems to conflate the destination address and destination node_id, those are two very different concepts and should be treated differently.
There was a problem hiding this comment.
Yeah I noticed that too. They are different concepts but just happen to be used exactly the same. I will get to work on the changes this afternoon.
c130fe0 to
5719cb9
Compare
| const jsmntok_t *tok, const u8 **scriptpubkey); | ||
|
|
||
| /* A specialized get_params used for both withdraw and fundchannel */ | ||
| bool json_wtx_get_params(struct wallet_tx * tx, const char * buffer, |
There was a problem hiding this comment.
I would suggest using a json_tok_wtx rather than replacing json_get_params: we may want to add different arguments to fundchannel vs withdraw in the future. So you would retain json_get_params but replace the satoshi-parsing with json_tok_wtx instead.
There was a problem hiding this comment.
Very good. I'm on it.
|
Ready to go. |
|
|
||
| bool all_funds; | ||
| const jsmntok_t *desttok; | ||
| const jsmntok_t *sattok; |
There was a problem hiding this comment.
I think we do not really need the jsmntok here? They only really make sense in combination with the buffer that holds all of their actual data, and we are not keeping a copy of the buffer anyway. I think for json_tok_wtx you can just receive the sattok as an argument, and let the caller handle destination as it sees fit.
|
Removed jsmn toks from wallet_tx. It cleaned up nicely. |
No new functionality, just a continuation of my work toward completing ElementsProject#665. I removed the common members of `struct withdrawal` and `struct fund_channel` and placed them in a new `struct wallet_tx`. Then it was fairly straightforward to reimplement the existing code in terms of `wallet_tx`. Since I made some structural changes I wanted to get this approved before I go any farther. Added 'all' to fundchannel help message.
| return ADDRESS_PARSE_UNRECOGNIZED; | ||
| } | ||
|
|
||
| bool json_tok_wtx(struct wallet_tx * tx, const char * buffer, |
There was a problem hiding this comment.
Other json_tok_* functions are usually of the form bool json_tok_whatever(const char *buffer, const jsmntok_t *tok, struct whatever *output) and do not call command_fail themselves. This is acceptable, though.
|
ACK 9c7a7bc |
No new functionality, just a continuation of my work toward completing #665.
I removed the common members of
struct withdrawalandstruct fund_channeland placed them in a new
struct wallet_tx. Then it was fairly straightforwardto reimplement the existing code in terms of
wallet_tx.Since I made some structural changes I wanted to get this approved before I
go any farther.