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

DONT MERGE - Feature/sync account utxos #38

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

HinsonSIDAN
Copy link
Member

WIP PR

// TODO: Testing code, remove upon finish
// utxos, err := maestroService.QueryAddressUtxos("addr_test1zptl0h0ceq3d4tgrlkqgyv2n5cwez0juj9rm63uw8nxhpv6u5ayjvx4rk9a29n2tqf4uv4nvfv2yy8tqs0kuue8luh9sczalnn")
// fmt.Printf(" err: %v\n", err)
// fmt.Printf("First utxo: %v\n", utxos[0])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncommenting these lines can see the behaviour of the query from maestro

Comment on lines +459 to +479

func (Am *AccountManager) SyncAccountUtxos(account *models.Account) (err error) {
// tradeAccountUtxosOnchain, err := Am.MaestroService.QueryAddressUtxos(account.TradeAccountAddress)
// if err != nil {
// return errors.New("error querying trade address utxos")
// }

// Requirements:
// 0. Query address utxos for both trade and change account
// 1. Include all utxos missing from DB
// 2. Include all utxo value missing from DB
// 3. If account ref script not set: Sync ref script to account for the first ref script utxos identified
// 4. If account ref script set: Include additional ref script utxos as fee utxos if identified
// 5. Sync utxos to spent if they are spent

// Step 1: Check if tx hash exist

// Step 2:

return err
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we outline the expected behaviour of this endpoint

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For utxos
AccountUtxo -> UnspentTransaction
AccountUtxo -> UtxoValue

return utxos, nil
}
utxos = append(utxos, addressUtxos.Data...)
param.Cursor(addressUtxos.NextCursor)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query we'll use for querying account utxos

@HinsonSIDAN
Copy link
Member Author

@leuhk I handover this ticket here

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

Successfully merging this pull request may close these issues.

1 participant