-
Notifications
You must be signed in to change notification settings - Fork 207
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
Some refactoring to make possible transactions checking client-side #728
Conversation
counterpartylib/lib/api.py
Outdated
param_name = message_module.FORMAT_DESCRIPTION[p] | ||
params[param_name] = unpacked[p] | ||
return params | ||
except Exception as e: |
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.
This line is no good.
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.
why? here I want to catch all possible errors. No matter what type of error, if there is one, that means that the data is incorrect.
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.
If there's a filesystem read error, e.g., that's not a problem with the unpacking, and it doesn't mean that the data is invalid.
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.
yeah you are right! I will fix that.
I moved transaction checking from Edit: however we can use the same checking functions in the API: https://github.com/CounterpartyXCP/counterpartyd/pull/728/files#diff-b4466fbb7c2afb413c8537b30b2d4bc7R285 |
5aef8a3
to
cfa69bd
Compare
counterpartylib/lib/transaction.py
Outdated
asset_id = data.pop(asset_param) | ||
param_name = asset_param_list[asset_param] | ||
try: | ||
data[param_name] = util.generate_asset_name(asset_id, block_index=333501) |
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.
Why do we need to try both ways? Shouldn't all newly created transactions use the new asset ids?
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.
hum.. I don't think, for instance we can have a send
transaction for an "old" asset.
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.
Ah, right. (I made that mistake before.)
@adamkrellenstein, there is a problem to check |
counterpartylib/lib/transaction.py
Outdated
params['destination'] = params['feed_address'] | ||
|
||
# No destination | ||
if asked_message_type in ['order', 'dividend', 'broadcast', 'cancel', 'destroy', 'execute', 'publish', 'rps', 'rpsresolve']: |
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.
Create new variables parsed_destinations = tx_info['destinations'].keys()
and desired_destination = params[destination']
, I think.
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.
hum.. seems difficult.. I need yet to well test each transaction.. when done I will give a try.
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.
EDIT: I think the code changed since you message, not sure if I understood well your remark.
counterpartylib/lib/transaction.py
Outdated
'callable_': False, | ||
'divisible': True | ||
} | ||
for param in data: |
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.
This block could be clearer, I think.
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.
I broke the block in several checks.
You mean mandatory parameters to the |
yep! OK. |
1eb272d
to
b61f3ca
Compare
@ouziel-slama, what's the status of this? |
@adamkrellenstein, the codebase is finished, but I need to add unit test for every RPC call. |
@adamkrellenstein, there is now enough tests for RPC calls... however the |
`counterpary-cli` needs the function `decode_output()` to check transactions generated by a server.
This method don't use the database or the backend. It used by `counterparty-client/gui` to check generated transaction generated by `counterparty-server`.
…d `destination` enable client side validation of generated transactions
OK, I rebased the branch and the kickstart works well.. don't know what happen the last time I tried.. |
@ouziel-slama, why/how did the kickstart fail? Are we sure it won't be an intermittent problem? |
@adamkrellenstein: the parsing didn't stop at BLOCK_START, he continued until block 1.. I don't understand how it's happened (that mean that the kickstart just skip the first block, see here: https://github.com/CounterpartyXCP/counterpartyd/blob/master/counterpartylib/lib/blocks.py#L835) |
Created this issue #749. |
5195971
to
38c5946
Compare
This Pr although useful, has diverged too much from the codebase, closing this and saving on branch pr728 |
Move sub functions outside
get_tx_info2()
becausecounterpary-cli
needs the functiondecode_output()
to check transactions generated by a server.Add
raw_unpack_data()
method. This method don't use the database or the backend.It is used by
counterparty-client/gui
to check transactions generated bycounterparty-server
.see: CounterpartyXCP/counterparty-cli#34