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

udb: use an account row interface. #1505

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

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented Jul 12, 2019

This updates account row related functions to use the account row interface for more flexibility and in preparation of adding new account types. Serialization and deserialization have been reduced to a one step process instead of converting to the intermediate dbAccountRow type first.

@dnldd dnldd force-pushed the return_base_account_row branch 2 times, most recently from ccf5aba to d521335 Compare July 14, 2019 00:55
@dnldd dnldd force-pushed the return_base_account_row branch from d521335 to d3aeb2d Compare August 6, 2019 14:51
wallet/udb/addressmanager.go Outdated Show resolved Hide resolved
@jrick
Copy link
Member

jrick commented Aug 13, 2019

Hmm, so this isn't quite what I had in mind when I was talking about changing fetchAccountInfo to not return a type specific to BIP0044 accounts. I was instead thinking that the call should return some sort of interface type, and that following code to either operates on the generic account interface, or type asserts it for more specific features (e.g. type asserting to access an xpub).

@dnldd dnldd force-pushed the return_base_account_row branch from d3aeb2d to c523076 Compare August 23, 2019 19:35
@dnldd dnldd changed the title udb: return base dbAccountRow for fetchAccountInfo. udb: use an account row interface. Aug 23, 2019
@dnldd
Copy link
Member Author

dnldd commented Aug 23, 2019

        // The serialized BIP0044 account raw data format is:
	//   <acctType><rdlen><encpubkeylen><encpubkey><encprivkeylen>
	//   <encprivkey><lastusedext><lastusedint><lastretext>
	//   <lastretint><namelen><name>
	//
	// 1 byte acctType + 4 bytes raw data length + 4 bytes encrypted
	// pubkey len + encrypted pubkey + 4 bytes encrypted privkey len +
	// encrypted privkey + 4 bytes last used external index + 4 bytes
	// last used internal index + 4 bytes last returned external +
	// 4 bytes last returned internal + 4 bytes name len + name

rdlen seems unnecessary at this point, should there be an account row upgrade to remove it?

This updates account row related functions to
use the account row interface for more flexibility.
Serialization and deserialization have  been
reduced to a one step process instead of converting
to the intermediate dbAccountRow type first.
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.

2 participants