stellar / stellar-core

Reference implementation for the peer-to-peer agent that manages the Stellar network.
https://www.stellar.org
Other
3.14k stars 973 forks source link

setOptions - unable to recover account after changing masterWeight and adding signer #1695

Closed xlhuang1 closed 6 years ago

xlhuang1 commented 6 years ago

Issue Type

BUG

Using the testnet test server.

Issue description

Trying to do some testing to implement smartcontracts. I defined a new account and funded with some lumens. On the walkthrough, the suggestion was to add a new sponsor signer with weight 1, and then set the masterWeight to 0 (disallowing the holding account from signing with its own key).

After running that transaction, which was successful, I tried to revert the changes so that the original holding account can sign for it once again. However, I tried to submit this as two separate transactions: First transaction - remove new signer (set signer as new signer and weight as 0), then signed with sponsor key. This was successful.

At this point, the account looks like this:

"thresholds": { "low_threshold": 1, "med_threshold": 1, "high_threshold": 1 }, "signers": [ { "public_key": "GDDOXI3TXLFDUZCYU24MW2ITZM72KX54PKDO3TYZYDAPGM37ML7TCJPM", "weight": 0, "key": "GDDOXI3TXLFDUZCYU24MW2ITZM72KX54PKDO3TYZYDAPGM37ML7TCJPM", "type": "ed25519_public_key" } ]

Now, I can no longer make any transactions because any transaction must be signed, the threshold is 1, and the weight of my current signer is 0. Does this mean that this account is basically permanently locked without access?

My second transaction would have been to either change the masterWeight back to 1 to allow the holding account to sign its own key, or add the original key back with a weight of 1. I guess I should have done this as just a second operation in my original Transaction 1...

Actual result

Unable to sign any transactions after setting new signer and then removing new signer, but not setting master weight back to 1.

MonsieurNicolas commented 6 years ago

This is by design: this is how you disable an account to disallow it from performing some (or all) transactions