If asset issuer account has been merged with another account what happens to assets by the account and trustlines created to that account?
2 Answers
Let's say you want to merge account X
to account Y
.
X cannot hold any offers or trustlines (therefore, no assets), according to the source code.
Otherwise, the operation will fail with "op_has_sub_entries"
.
And account X will be charged 100 stroops txFee, and seq_num += 1.
{
"type": "https://stellar.org/horizon-errors/transaction_failed",
"title": "Transaction Failed",
"status": 400,
"detail": "The transaction failed when submitted to the stellar network. The `extras.result_codes` field on this response contains further details. Descriptions of each code can be found at: https://www.stellar.org/developers/learn/concepts/list-of-operations.html",
"extras": {
"envelope_xdr": "AAAAAAWb/DbpS8kPxCqdXLV+Az4ibTOwxPLFDqbAmDc3/vG/AAAAZACD6qIAAAACAAAAAAAAAAAAAAABAAAAAAAAAAgAAAAAFZy28/5fhGoXqWueZaco8fRv25qq2EslnODyi8naNNMAAAAAAAAAATf+8b8AAABA/tFZ+/M6he+cbYoLXnBOkT9Hzh0AsliSXNu0vrzbBLHNKIUwAAxhafcPu49EFOKk7/9RooD2Q6zchw8X3pRSDQ==",
"result_codes": {
"transaction": "tx_failed",
"operations": [
"op_has_sub_entries"
]
},
"result_xdr": "AAAAAAAAAGT/////AAAAAQAAAAAAAAAI/////AAAAAA="
}
}
[EDIT]
So, if you want to merge X to Y, you need to destroy all its trustlines and offers first.
[Additional info]
If you possess balance > 0 for an asset and try to directly Change Trust
to 0, you will experience "op_invalid_limit"
error. You need to transfer away every asset until its balance is 0, and then Change Trust
every asset to TrustLimit=0
.
You cannot merge accounts that have subentries (trustlines, offers, data).
Subentries can be found by going to https://horizon.stellar.org/accounts/<your_account_id>
and searching for the subentry_count
field.
You can find more information about the merge operation in the docs here.