Skip to content
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

SpentCoinState.Clone could not work as expected #1368

Closed
shargon opened this issue Dec 16, 2019 · 6 comments
Closed

SpentCoinState.Clone could not work as expected #1368

shargon opened this issue Dec 16, 2019 · 6 comments

Comments

@shargon
Copy link
Member

shargon commented Dec 16, 2019

Describe the bug
When we clone a SpentCoinState, we copy the mutable object Items, it should be copied instead of referenced.

To Reproduce

  1. Create a new SpentCoinState
  2. Clone it
  3. Alter the new object, and it will alter the father

Expected behavior
Cloned items should be independent.

(Optional) Additional context
neo-2

@cloud8little
Copy link
Contributor

@shargon how can we reproduce this from user scenario? could you enlight us?

@shargon
Copy link
Member Author

shargon commented Feb 3, 2020

@nicolegys
Copy link
Contributor

With this UT without the patch
https://github.com/neo-project/neo/pull/1369/files#diff-8af706d1e9e7ef1671a59d4660fb0ef2R29

It seems that this UT doesn't test FromReplica method, it assign n a value using Clone.

@shargon
Copy link
Member Author

shargon commented Feb 3, 2020

Take a look now here https://github.com/neo-project/neo/pull/1369/files#diff-8af706d1e9e7ef1671a59d4660fb0ef2R37

@nicolegys
Copy link
Contributor

@Tommo-L
Copy link
Contributor

Tommo-L commented Mar 2, 2020

Close?

@shargon shargon closed this as completed Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants