-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: develop
Are you sure you want to change the base?
Conversation
// 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]) |
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.
Uncommenting these lines can see the behaviour of the query from maestro
|
||
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 | ||
} |
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.
here we outline the expected behaviour of this endpoint
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.
For utxos
AccountUtxo -> UnspentTransaction
AccountUtxo -> UtxoValue
return utxos, nil | ||
} | ||
utxos = append(utxos, addressUtxos.Data...) | ||
param.Cursor(addressUtxos.NextCursor) |
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.
The query we'll use for querying account utxos
@leuhk I handover this ticket here |
WIP PR